Quality of Life improvements
* disables ordering of parcel_group ("Gemarkung") column on tables
* ordering can not be done properly due to more complex nature of this column's content
* introduces "Keine Geometrie vorhanden" message instead of hour glass icon on entries where no geometry has been entered yet
* properly orders last_modified column by moving null values to the lower end of the ordering
This commit is contained in:
@@ -14,11 +14,11 @@ from django.utils.translation import gettext_lazy as _
|
||||
from compensation.filters.compensation import CompensationTableFilter
|
||||
from compensation.models import Compensation
|
||||
from konova.utils.message_templates import DATA_IS_UNCHECKED, DATA_CHECKED_ON_TEMPLATE, DATA_CHECKED_PREVIOUSLY_TEMPLATE
|
||||
from konova.utils.tables import BaseTable, TableRenderMixin
|
||||
from konova.utils.tables import BaseTable, TableRenderMixin, TableOrderMixin
|
||||
import django_tables2 as tables
|
||||
|
||||
|
||||
class CompensationTable(BaseTable, TableRenderMixin):
|
||||
class CompensationTable(BaseTable, TableRenderMixin, TableOrderMixin):
|
||||
id = tables.Column(
|
||||
verbose_name=_("Identifier"),
|
||||
orderable=True,
|
||||
@@ -31,7 +31,7 @@ class CompensationTable(BaseTable, TableRenderMixin):
|
||||
)
|
||||
d = tables.Column(
|
||||
verbose_name=_("Parcel gmrkng"),
|
||||
orderable=True,
|
||||
orderable=False,
|
||||
accessor="geometry",
|
||||
)
|
||||
c = tables.Column(
|
||||
@@ -126,28 +126,6 @@ class CompensationTable(BaseTable, TableRenderMixin):
|
||||
)
|
||||
return format_html(html)
|
||||
|
||||
def render_d(self, value, record: Compensation):
|
||||
""" Renders the parcel district column for a compensation
|
||||
|
||||
Args:
|
||||
value (str): The geometry
|
||||
record (Compensation): The compensation record
|
||||
|
||||
Returns:
|
||||
|
||||
"""
|
||||
parcels = value.get_underlying_parcels().values_list(
|
||||
"parcel_group__name",
|
||||
flat=True
|
||||
).distinct()
|
||||
html = render_to_string(
|
||||
"table/gmrkng_col.html",
|
||||
{
|
||||
"entries": parcels
|
||||
}
|
||||
)
|
||||
return html
|
||||
|
||||
def render_r(self, value, record: Compensation):
|
||||
""" Renders the registered column for a compensation
|
||||
|
||||
|
||||
@@ -13,12 +13,12 @@ from django.utils.translation import gettext_lazy as _
|
||||
|
||||
from compensation.filters.eco_account import EcoAccountTableFilter
|
||||
from compensation.models import EcoAccount
|
||||
from konova.utils.tables import TableRenderMixin, BaseTable
|
||||
from konova.utils.tables import TableRenderMixin, BaseTable, TableOrderMixin
|
||||
|
||||
import django_tables2 as tables
|
||||
|
||||
|
||||
class EcoAccountTable(BaseTable, TableRenderMixin):
|
||||
class EcoAccountTable(BaseTable, TableRenderMixin, TableOrderMixin):
|
||||
id = tables.Column(
|
||||
verbose_name=_("Identifier"),
|
||||
orderable=True,
|
||||
@@ -31,7 +31,7 @@ class EcoAccountTable(BaseTable, TableRenderMixin):
|
||||
)
|
||||
d = tables.Column(
|
||||
verbose_name=_("Parcel gmrkng"),
|
||||
orderable=True,
|
||||
orderable=False,
|
||||
accessor="geometry",
|
||||
)
|
||||
av = tables.Column(
|
||||
@@ -113,28 +113,6 @@ class EcoAccountTable(BaseTable, TableRenderMixin):
|
||||
html = render_to_string("konova/widgets/progressbar.html", {"value": value_relative})
|
||||
return format_html(html)
|
||||
|
||||
def render_d(self, value, record):
|
||||
""" Renders the parcel district column for a compensation
|
||||
|
||||
Args:
|
||||
value (str): The geometry
|
||||
record (Compensation): The compensation record
|
||||
|
||||
Returns:
|
||||
|
||||
"""
|
||||
parcels = value.get_underlying_parcels().values_list(
|
||||
"parcel_group__name",
|
||||
flat=True
|
||||
).distinct()
|
||||
html = render_to_string(
|
||||
"table/gmrkng_col.html",
|
||||
{
|
||||
"entries": parcels
|
||||
}
|
||||
)
|
||||
return html
|
||||
|
||||
def render_r(self, value, record: EcoAccount):
|
||||
""" Renders the recorded column for an eco account
|
||||
|
||||
|
||||
Reference in New Issue
Block a user