#86 Parcel district column for all
* adds parcel district column for all major data objects * adds warning about intervention-revocation on index view of compensations * adds warning about intervention-revocation on detail view of related compensations
This commit is contained in:
@@ -6,6 +6,7 @@ Created on: 19.08.21
|
||||
|
||||
"""
|
||||
from django.http import HttpRequest
|
||||
from django.template.loader import render_to_string
|
||||
from django.utils.html import format_html
|
||||
from django.utils.timezone import localtime
|
||||
from django.utils.translation import gettext_lazy as _
|
||||
@@ -34,6 +35,11 @@ class EmaTable(BaseTable, TableRenderMixin):
|
||||
orderable=True,
|
||||
accessor="title",
|
||||
)
|
||||
d = tables.Column(
|
||||
verbose_name=_("Parcel gmrkng"),
|
||||
orderable=True,
|
||||
accessor="geometry",
|
||||
)
|
||||
r = tables.Column(
|
||||
verbose_name=_("Recorded"),
|
||||
orderable=True,
|
||||
@@ -87,6 +93,29 @@ class EmaTable(BaseTable, TableRenderMixin):
|
||||
)
|
||||
return format_html(html)
|
||||
|
||||
def render_d(self, value, record: Ema):
|
||||
""" Renders the parcel district column for a ema
|
||||
|
||||
Args:
|
||||
value (str): The geometry
|
||||
record (Ema): The ema record
|
||||
|
||||
Returns:
|
||||
|
||||
"""
|
||||
parcels = value.parcels.values_list(
|
||||
"gmrkng",
|
||||
flat=True
|
||||
).distinct()
|
||||
html = render_to_string(
|
||||
"table/gmrkng_col.html",
|
||||
{
|
||||
"entries": parcels
|
||||
}
|
||||
)
|
||||
return html
|
||||
|
||||
|
||||
def render_r(self, value, record: Ema):
|
||||
""" Renders the registered column for a EMA
|
||||
|
||||
|
||||
Reference in New Issue
Block a user