#86 Revocation rendering if needed
* renders revocation warning on the index view if a revocation exists
This commit is contained in:
parent
fd3fe17953
commit
a759eb2453
@ -84,14 +84,17 @@ class InterventionTable(BaseTable, TableRenderMixin):
|
|||||||
Returns:
|
Returns:
|
||||||
|
|
||||||
"""
|
"""
|
||||||
html = ""
|
context = {
|
||||||
html += self.render_link(
|
"tooltip": _("Open {}").format(_("Intervention")),
|
||||||
tooltip=_("Open {}").format(_("Intervention")),
|
"content": value,
|
||||||
href=reverse("intervention:detail", args=(record.id,)),
|
"url": reverse("intervention:detail", args=(record.id,)),
|
||||||
txt=value,
|
"has_revocations": record.legal.revocations.exists()
|
||||||
new_tab=False,
|
}
|
||||||
|
html = render_to_string(
|
||||||
|
"table/revocation_warning_col.html",
|
||||||
|
context
|
||||||
)
|
)
|
||||||
return format_html(html)
|
return html
|
||||||
|
|
||||||
def render_c(self, value, record: Intervention):
|
def render_c(self, value, record: Intervention):
|
||||||
""" Renders the checked column for an intervention
|
""" Renders the checked column for an intervention
|
||||||
@ -127,7 +130,7 @@ class InterventionTable(BaseTable, TableRenderMixin):
|
|||||||
Returns:
|
Returns:
|
||||||
|
|
||||||
"""
|
"""
|
||||||
parcels = value.parcels.all().values_list(
|
parcels = value.parcels.values_list(
|
||||||
"gmrkng",
|
"gmrkng",
|
||||||
flat=True
|
flat=True
|
||||||
).distinct()
|
).distinct()
|
||||||
@ -139,7 +142,6 @@ class InterventionTable(BaseTable, TableRenderMixin):
|
|||||||
)
|
)
|
||||||
return html
|
return html
|
||||||
|
|
||||||
|
|
||||||
def render_r(self, value, record: Intervention):
|
def render_r(self, value, record: Intervention):
|
||||||
""" Renders the recorded column for an intervention
|
""" Renders the recorded column for an intervention
|
||||||
|
|
||||||
|
14
templates/table/revocation_warning_col.html
Normal file
14
templates/table/revocation_warning_col.html
Normal file
@ -0,0 +1,14 @@
|
|||||||
|
{% load i18n fontawesome_5 %}
|
||||||
|
|
||||||
|
{% if has_revocations %}
|
||||||
|
<strong>
|
||||||
|
<a href="{{url}}" title="{% trans 'Revocations exists' %}">
|
||||||
|
{% fa5_icon 'ban' %}
|
||||||
|
{{content}}
|
||||||
|
</a>
|
||||||
|
</strong>
|
||||||
|
{% else %}
|
||||||
|
<a href="{{url}}" title="{{tooltip}}">
|
||||||
|
{{content}}
|
||||||
|
</a>
|
||||||
|
{% endif %}
|
Loading…
Reference in New Issue
Block a user