# 61 Filter frontend

* adds filtering for file number
* updates translations
This commit is contained in:
mpeltriaux 2022-01-11 17:29:36 +01:00
parent 5d5d8b1243
commit 5bca8fc8f7
4 changed files with 110 additions and 60 deletions

View File

@ -8,11 +8,23 @@ Created on: 29.07.21
import django_filters import django_filters
from django.utils.translation import gettext_lazy as _ from django.utils.translation import gettext_lazy as _
from django import forms from django import forms
from django.db.models import QuerySet from django.db.models import QuerySet, Q
from konova.filters import QueryTableFilter, CheckboxTableFilter from konova.filters import QueryTableFilter, CheckboxTableFilter
class QueryCompensationTableFilter(QueryTableFilter):
""" Specialization of regular QueryTableFilter for compensation model
"""
def filter_file_number(self, queryset, name, value) -> QuerySet:
queryset = queryset.filter(
Q(intervention__responsible__registration_file_number__icontains=value) |
Q(intervention__responsible__conservation_file_number__icontains=value)
)
return queryset
class CheckboxCompensationTableFilter(CheckboxTableFilter): class CheckboxCompensationTableFilter(CheckboxTableFilter):
""" Specialization of regular CheckboxTableFilter for compensation model """ Specialization of regular CheckboxTableFilter for compensation model
@ -71,7 +83,7 @@ class CompensationTableFilter:
qs = kwargs.get("queryset", None) qs = kwargs.get("queryset", None)
request_data = kwargs.get("data", None) request_data = kwargs.get("data", None)
self.query_filter = QueryTableFilter( self.query_filter = QueryCompensationTableFilter(
user=user, user=user,
data=request_data, data=request_data,
queryset=qs, queryset=qs,
@ -89,7 +101,11 @@ class CheckboxEcoAccountTableFilter(CheckboxTableFilter):
method='filter_only_show_unrecorded', method='filter_only_show_unrecorded',
label=_("Show only unrecorded"), label=_("Show only unrecorded"),
label_suffix=_(""), label_suffix=_(""),
widget=forms.CheckboxInput() widget=forms.CheckboxInput(
attrs={
"class": "form-check-input",
}
)
) )
def filter_show_all(self, queryset, name, value) -> QuerySet: def filter_show_all(self, queryset, name, value) -> QuerySet:

View File

@ -57,6 +57,28 @@ class KeywordTableFilterMixin(django_filters.FilterSet):
return queryset.filter(q) return queryset.filter(q)
class FileNumberTableFilterMixin(django_filters.FilterSet):
rf = django_filters.CharFilter(
method="filter_file_number",
label=_(""),
label_suffix=_(""),
widget=forms.TextInput(
attrs={
"placeholder": _("File number"),
"title": _("Search for file number"),
"class": "form-control",
}
),
)
def filter_file_number(self, queryset, name, value) -> QuerySet:
queryset = queryset.filter(
Q(responsible__registration_file_number__icontains=value) |
Q(responsible__conservation_file_number__icontains=value)
)
return queryset
class GeoReferencedTableFilterMixin(django_filters.FilterSet): class GeoReferencedTableFilterMixin(django_filters.FilterSet):
""" A mixin for AbstractTableFilter """ A mixin for AbstractTableFilter
@ -329,7 +351,10 @@ class RecordableTableFilterMixin(django_filters.FilterSet):
return queryset return queryset
class QueryTableFilter(AbstractTableFilter, KeywordTableFilterMixin, GeoReferencedTableFilterMixin): class QueryTableFilter(AbstractTableFilter,
KeywordTableFilterMixin,
FileNumberTableFilterMixin,
GeoReferencedTableFilterMixin):
""" TableFilter holding different filter options for query related filtering """ TableFilter holding different filter options for query related filtering
""" """

Binary file not shown.

View File

@ -3,25 +3,26 @@
# This file is distributed under the same license as the PACKAGE package. # This file is distributed under the same license as the PACKAGE package.
# FIRST AUTHOR <EMAIL@ADDRESS>, YEAR. # FIRST AUTHOR <EMAIL@ADDRESS>, YEAR.
# #
#: compensation/filters.py:71 compensation/forms/modalForms.py:34 #: compensation/filters.py:91 compensation/forms/modalForms.py:34
#: compensation/forms/modalForms.py:45 compensation/forms/modalForms.py:61 #: compensation/forms/modalForms.py:45 compensation/forms/modalForms.py:61
#: compensation/forms/modalForms.py:238 compensation/forms/modalForms.py:316 #: compensation/forms/modalForms.py:238 compensation/forms/modalForms.py:316
#: intervention/filters.py:25 intervention/filters.py:31
#: intervention/forms/forms.py:52 intervention/forms/forms.py:154 #: intervention/forms/forms.py:52 intervention/forms/forms.py:154
#: intervention/forms/forms.py:166 intervention/forms/modalForms.py:125 #: intervention/forms/forms.py:166 intervention/forms/modalForms.py:125
#: intervention/forms/modalForms.py:138 intervention/forms/modalForms.py:151 #: intervention/forms/modalForms.py:138 intervention/forms/modalForms.py:151
#: konova/filters.py:64 konova/filters.py:65 konova/filters.py:76 #: konova/filters.py:63 konova/filters.py:64 konova/filters.py:91
#: konova/filters.py:77 konova/filters.py:88 konova/filters.py:89 #: konova/filters.py:92 konova/filters.py:104 konova/filters.py:105
#: konova/filters.py:100 konova/filters.py:101 konova/filters.py:113 #: konova/filters.py:117 konova/filters.py:118 konova/filters.py:130
#: konova/filters.py:114 konova/forms.py:140 konova/forms.py:241 #: konova/filters.py:131 konova/filters.py:144 konova/filters.py:145
#: konova/forms.py:312 konova/forms.py:339 konova/forms.py:349 #: konova/filters.py:280 konova/filters.py:324 konova/forms.py:140
#: konova/forms.py:362 konova/forms.py:374 konova/forms.py:392 user/forms.py:38 #: konova/forms.py:241 konova/forms.py:312 konova/forms.py:339
#: konova/forms.py:349 konova/forms.py:362 konova/forms.py:374
#: konova/forms.py:392 user/forms.py:38
#, fuzzy #, fuzzy
msgid "" msgid ""
msgstr "" msgstr ""
"Project-Id-Version: PACKAGE VERSION\n" "Project-Id-Version: PACKAGE VERSION\n"
"Report-Msgid-Bugs-To: \n" "Report-Msgid-Bugs-To: \n"
"POT-Creation-Date: 2022-01-11 09:31+0100\n" "POT-Creation-Date: 2022-01-11 17:07+0100\n"
"PO-Revision-Date: YEAR-MO-DA HO:MI+ZONE\n" "PO-Revision-Date: YEAR-MO-DA HO:MI+ZONE\n"
"Last-Translator: FULL NAME <EMAIL@ADDRESS>\n" "Last-Translator: FULL NAME <EMAIL@ADDRESS>\n"
"Language-Team: LANGUAGE <LL@li.org>\n" "Language-Team: LANGUAGE <LL@li.org>\n"
@ -147,7 +148,7 @@ msgstr "Geprüft"
#: analysis/templates/analysis/reports/includes/intervention/compensated_by.html:9 #: analysis/templates/analysis/reports/includes/intervention/compensated_by.html:9
#: analysis/templates/analysis/reports/includes/intervention/laws.html:20 #: analysis/templates/analysis/reports/includes/intervention/laws.html:20
#: analysis/templates/analysis/reports/includes/old_data/amount.html:18 #: analysis/templates/analysis/reports/includes/old_data/amount.html:18
#: compensation/tables.py:41 compensation/tables.py:181 #: compensation/tables.py:41 compensation/tables.py:182
#: compensation/templates/compensation/detail/compensation/view.html:77 #: compensation/templates/compensation/detail/compensation/view.html:77
#: compensation/templates/compensation/detail/eco_account/includes/deductions.html:31 #: compensation/templates/compensation/detail/eco_account/includes/deductions.html:31
#: compensation/templates/compensation/detail/eco_account/view.html:44 #: compensation/templates/compensation/detail/eco_account/view.html:44
@ -233,7 +234,7 @@ msgstr "Kompensationsart"
#: analysis/templates/analysis/reports/includes/intervention/compensated_by.html:15 #: analysis/templates/analysis/reports/includes/intervention/compensated_by.html:15
#: analysis/templates/analysis/reports/includes/old_data/amount.html:29 #: analysis/templates/analysis/reports/includes/old_data/amount.html:29
#: compensation/tables.py:84 #: compensation/tables.py:85
#: compensation/templates/compensation/detail/compensation/view.html:19 #: compensation/templates/compensation/detail/compensation/view.html:19
#: konova/templates/konova/home.html:49 templates/navbars/navbar.html:28 #: konova/templates/konova/home.html:49 templates/navbars/navbar.html:28
msgid "Compensation" msgid "Compensation"
@ -278,14 +279,14 @@ msgstr "Typ"
#: analysis/templates/analysis/reports/includes/old_data/amount.html:24 #: analysis/templates/analysis/reports/includes/old_data/amount.html:24
#: intervention/forms/modalForms.py:306 intervention/forms/modalForms.py:313 #: intervention/forms/modalForms.py:306 intervention/forms/modalForms.py:313
#: intervention/tables.py:88 #: intervention/tables.py:89
#: intervention/templates/intervention/detail/view.html:19 #: intervention/templates/intervention/detail/view.html:19
#: konova/templates/konova/home.html:11 templates/navbars/navbar.html:22 #: konova/templates/konova/home.html:11 templates/navbars/navbar.html:22
msgid "Intervention" msgid "Intervention"
msgstr "Eingriff" msgstr "Eingriff"
#: analysis/templates/analysis/reports/includes/old_data/amount.html:34 #: analysis/templates/analysis/reports/includes/old_data/amount.html:34
#: compensation/tables.py:224 #: compensation/tables.py:226
#: compensation/templates/compensation/detail/eco_account/view.html:19 #: compensation/templates/compensation/detail/eco_account/view.html:19
#: intervention/forms/modalForms.py:279 intervention/forms/modalForms.py:286 #: intervention/forms/modalForms.py:279 intervention/forms/modalForms.py:286
#: konova/templates/konova/home.html:88 templates/navbars/navbar.html:34 #: konova/templates/konova/home.html:88 templates/navbars/navbar.html:34
@ -300,12 +301,12 @@ msgstr "Altfälle"
msgid "Before" msgid "Before"
msgstr "Vor" msgstr "Vor"
#: compensation/filters.py:70 #: compensation/filters.py:90
msgid "Show only unrecorded" msgid "Show only unrecorded"
msgstr "Nur unverzeichnete anzeigen" msgstr "Nur unverzeichnete anzeigen"
#: compensation/forms/forms.py:32 compensation/tables.py:25 #: compensation/forms/forms.py:32 compensation/tables.py:25
#: compensation/tables.py:166 ema/tables.py:28 intervention/forms/forms.py:26 #: compensation/tables.py:167 ema/tables.py:28 intervention/forms/forms.py:26
#: intervention/tables.py:23 #: intervention/tables.py:23
#: intervention/templates/intervention/detail/includes/compensations.html:30 #: intervention/templates/intervention/detail/includes/compensations.html:30
msgid "Identifier" msgid "Identifier"
@ -316,7 +317,7 @@ msgid "Generated automatically"
msgstr "Automatisch generiert" msgstr "Automatisch generiert"
#: compensation/forms/forms.py:44 compensation/tables.py:30 #: compensation/forms/forms.py:44 compensation/tables.py:30
#: compensation/tables.py:171 #: compensation/tables.py:172
#: compensation/templates/compensation/detail/compensation/includes/documents.html:28 #: compensation/templates/compensation/detail/compensation/includes/documents.html:28
#: compensation/templates/compensation/detail/compensation/view.html:31 #: compensation/templates/compensation/detail/compensation/view.html:31
#: compensation/templates/compensation/detail/eco_account/includes/documents.html:28 #: compensation/templates/compensation/detail/eco_account/includes/documents.html:28
@ -635,65 +636,65 @@ msgstr ""
"Es wurde bereits mehr Fläche abgebucht, als Sie nun als abbuchbar einstellen " "Es wurde bereits mehr Fläche abgebucht, als Sie nun als abbuchbar einstellen "
"wollen. Kontaktieren Sie die für die Abbuchungen verantwortlichen Nutzer!" "wollen. Kontaktieren Sie die für die Abbuchungen verantwortlichen Nutzer!"
#: compensation/tables.py:47 compensation/tables.py:187 ema/tables.py:44 #: compensation/tables.py:47 compensation/tables.py:188 ema/tables.py:44
#: intervention/tables.py:51 #: intervention/tables.py:51
msgid "Editable" msgid "Editable"
msgstr "Freigegeben" msgstr "Freigegeben"
#: compensation/tables.py:53 compensation/tables.py:193 ema/tables.py:50 #: compensation/tables.py:53 compensation/tables.py:194 ema/tables.py:50
#: intervention/tables.py:57 #: intervention/tables.py:57
msgid "Last edit" msgid "Last edit"
msgstr "Zuletzt bearbeitet" msgstr "Zuletzt bearbeitet"
#: compensation/tables.py:84 compensation/tables.py:224 ema/tables.py:82 #: compensation/tables.py:85 compensation/tables.py:226 ema/tables.py:83
#: intervention/tables.py:88 #: intervention/tables.py:89
msgid "Open {}" msgid "Open {}"
msgstr "Öffne {}" msgstr "Öffne {}"
#: compensation/tables.py:105 intervention/tables.py:107 #: compensation/tables.py:106 intervention/tables.py:108
msgid "Not checked yet" msgid "Not checked yet"
msgstr "Noch nicht geprüft" msgstr "Noch nicht geprüft"
#: compensation/tables.py:110 intervention/tables.py:112 #: compensation/tables.py:111 intervention/tables.py:113
msgid "Checked on {} by {}" msgid "Checked on {} by {}"
msgstr "Am {} von {} geprüft worden" msgstr "Am {} von {} geprüft worden"
#: compensation/tables.py:129 #: compensation/tables.py:130
#: compensation/templates/compensation/detail/compensation/view.html:80 #: compensation/templates/compensation/detail/compensation/view.html:80
#: compensation/templates/compensation/detail/eco_account/includes/deductions.html:56 #: compensation/templates/compensation/detail/eco_account/includes/deductions.html:56
#: compensation/templates/compensation/detail/eco_account/view.html:47 #: compensation/templates/compensation/detail/eco_account/view.html:47
#: ema/tables.py:101 ema/templates/ema/detail/view.html:38 #: ema/tables.py:102 ema/templates/ema/detail/view.html:38
#: intervention/tables.py:131 #: intervention/tables.py:132
#: intervention/templates/intervention/detail/view.html:85 #: intervention/templates/intervention/detail/view.html:85
msgid "Not recorded yet" msgid "Not recorded yet"
msgstr "Noch nicht verzeichnet" msgstr "Noch nicht verzeichnet"
#: compensation/tables.py:134 compensation/tables.py:262 ema/tables.py:106 #: compensation/tables.py:135 compensation/tables.py:264 ema/tables.py:107
#: intervention/tables.py:136 #: intervention/tables.py:137
msgid "Recorded on {} by {}" msgid "Recorded on {} by {}"
msgstr "Am {} von {} verzeichnet worden" msgstr "Am {} von {} verzeichnet worden"
#: compensation/tables.py:158 compensation/tables.py:284 ema/tables.py:129 #: compensation/tables.py:159 compensation/tables.py:286 ema/tables.py:130
#: intervention/tables.py:159 #: intervention/tables.py:160
msgid "Full access granted" msgid "Full access granted"
msgstr "Für Sie freigegeben - Datensatz kann bearbeitet werden" msgstr "Für Sie freigegeben - Datensatz kann bearbeitet werden"
#: compensation/tables.py:158 compensation/tables.py:284 ema/tables.py:129 #: compensation/tables.py:159 compensation/tables.py:286 ema/tables.py:130
#: intervention/tables.py:159 #: intervention/tables.py:160
msgid "Access not granted" msgid "Access not granted"
msgstr "Nicht freigegeben - Datensatz nur lesbar" msgstr "Nicht freigegeben - Datensatz nur lesbar"
#: compensation/tables.py:176 #: compensation/tables.py:177
#: compensation/templates/compensation/detail/eco_account/view.html:35 #: compensation/templates/compensation/detail/eco_account/view.html:35
#: konova/templates/konova/widgets/progressbar.html:3 #: konova/templates/konova/widgets/progressbar.html:3
msgid "Available" msgid "Available"
msgstr "Verfügbar" msgstr "Verfügbar"
#: compensation/tables.py:202 #: compensation/tables.py:203
msgid "Eco Accounts" msgid "Eco Accounts"
msgstr "Ökokonten" msgstr "Ökokonten"
#: compensation/tables.py:257 #: compensation/tables.py:259
msgid "Not recorded yet. Can not be used for deductions, yet." msgid "Not recorded yet. Can not be used for deductions, yet."
msgstr "" msgstr ""
"Noch nicht verzeichnet. Kann noch nicht für Abbuchungen genutzt werden." "Noch nicht verzeichnet. Kann noch nicht für Abbuchungen genutzt werden."
@ -1179,7 +1180,7 @@ msgstr ""
"Maßnahmen aus Ersatzzahlungen, die nach 2015 rechtskräftig wurden, werden " "Maßnahmen aus Ersatzzahlungen, die nach 2015 rechtskräftig wurden, werden "
"durch die Stiftung Natur und Umwelt verwaltet." "durch die Stiftung Natur und Umwelt verwaltet."
#: ema/tables.py:82 templates/navbars/navbar.html:43 #: ema/tables.py:83 templates/navbars/navbar.html:43
msgid "EMA" msgid "EMA"
msgstr "" msgstr ""
@ -1199,14 +1200,6 @@ msgstr "EMA {} bearbeitet"
msgid "EMA removed" msgid "EMA removed"
msgstr "EMA entfernt" msgstr "EMA entfernt"
#: intervention/filters.py:24
msgid "Show unshared"
msgstr "Nicht freigegebene anzeigen"
#: intervention/filters.py:30
msgid "Show recorded"
msgstr "Verzeichnete anzeigen"
#: intervention/forms/forms.py:44 #: intervention/forms/forms.py:44
msgid "Construction XY; Location ABC" msgid "Construction XY; Location ABC"
msgstr "Bauvorhaben XY; Flur ABC" msgstr "Bauvorhaben XY; Flur ABC"
@ -1376,11 +1369,11 @@ msgstr ""
msgid "Revocation" msgid "Revocation"
msgstr "Widerspruch" msgstr "Widerspruch"
#: intervention/tables.py:176 #: intervention/tables.py:177
msgid "No revocation" msgid "No revocation"
msgstr "Kein Widerspruch" msgstr "Kein Widerspruch"
#: intervention/tables.py:182 #: intervention/tables.py:183
msgid "Revocation from {}, added on {} by {}" msgid "Revocation from {}, added on {} by {}"
msgstr "Widerspruch vom {}, am {} von {} hinzugefügt" msgstr "Widerspruch vom {}, am {} von {} hinzugefügt"
@ -1515,46 +1508,62 @@ msgstr ""
"somit nichts eingeben, bearbeiten oder sonstige Aktionen ausführen. " "somit nichts eingeben, bearbeiten oder sonstige Aktionen ausführen. "
"Kontaktieren Sie bitte einen Administrator. +++" "Kontaktieren Sie bitte einen Administrator. +++"
#: konova/filters.py:67
msgid "File number"
msgstr "Aktenzeichen"
#: konova/filters.py:68 #: konova/filters.py:68
msgid "Search for file number"
msgstr "Nach Aktenzeichen suchen"
#: konova/filters.py:95
msgid "District" msgid "District"
msgstr "Kreis" msgstr "Kreis"
#: konova/filters.py:69 #: konova/filters.py:96
msgid "Search for district" msgid "Search for district"
msgstr "Nach Kreis suchen" msgstr "Nach Kreis suchen"
#: konova/filters.py:80 #: konova/filters.py:108
msgid "Parcel gmrkng" msgid "Parcel gmrkng"
msgstr "Gemarkung" msgstr "Gemarkung"
#: konova/filters.py:81 #: konova/filters.py:109
msgid "Search for parcel gmrkng" msgid "Search for parcel gmrkng"
msgstr "Nach Gemarkung suchen" msgstr "Nach Gemarkung suchen"
#: konova/filters.py:92 konova/templates/konova/includes/parcels.html:18 #: konova/filters.py:121 konova/templates/konova/includes/parcels.html:18
msgid "Parcel" msgid "Parcel"
msgstr "Flur" msgstr "Flur"
#: konova/filters.py:93 #: konova/filters.py:122
msgid "Search for parcel" msgid "Search for parcel"
msgstr "Nach Flur suchen" msgstr "Nach Flur suchen"
#: konova/filters.py:104 konova/templates/konova/includes/parcels.html:19 #: konova/filters.py:134 konova/templates/konova/includes/parcels.html:19
msgid "Parcel counter" msgid "Parcel counter"
msgstr "Flurstückzähler" msgstr "Flurstückzähler"
#: konova/filters.py:105 #: konova/filters.py:135
msgid "Search for parcel counter" msgid "Search for parcel counter"
msgstr "Nach Flurstückzähler suchen" msgstr "Nach Flurstückzähler suchen"
#: konova/filters.py:117 konova/templates/konova/includes/parcels.html:20 #: konova/filters.py:148 konova/templates/konova/includes/parcels.html:20
msgid "Parcel number" msgid "Parcel number"
msgstr "Flurstücknenner" msgstr "Flurstücknenner"
#: konova/filters.py:118 #: konova/filters.py:149
msgid "Search for parcel number" msgid "Search for parcel number"
msgstr "Nach Flurstücknenner suchen" msgstr "Nach Flurstücknenner suchen"
#: konova/filters.py:279
msgid "Show unshared"
msgstr "Nicht freigegebene anzeigen"
#: konova/filters.py:323
msgid "Show recorded"
msgstr "Verzeichnete anzeigen"
#: konova/forms.py:37 templates/form/collapsable/form.html:62 #: konova/forms.py:37 templates/form/collapsable/form.html:62
msgid "Save" msgid "Save"
msgstr "Speichern" msgstr "Speichern"
@ -1921,11 +1930,11 @@ msgstr "Starte Suche"
msgid "Results per page" msgid "Results per page"
msgstr "Treffer pro Seite" msgstr "Treffer pro Seite"
#: templates/generic_index.html:82 templates/generic_index.html:88 #: templates/generic_index.html:82 templates/generic_index.html:99
msgid "Filter" msgid "Filter"
msgstr "" msgstr ""
#: templates/generic_index.html:90 #: templates/generic_index.html:101
msgid "Apply filter" msgid "Apply filter"
msgstr "Filter anwenden" msgstr "Filter anwenden"