diff --git a/compensation/filters.py b/compensation/filters.py index b44b900a..b4dab866 100644 --- a/compensation/filters.py +++ b/compensation/filters.py @@ -8,11 +8,23 @@ Created on: 29.07.21 import django_filters from django.utils.translation import gettext_lazy as _ from django import forms -from django.db.models import QuerySet +from django.db.models import QuerySet, Q 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): """ Specialization of regular CheckboxTableFilter for compensation model @@ -71,7 +83,7 @@ class CompensationTableFilter: qs = kwargs.get("queryset", None) request_data = kwargs.get("data", None) - self.query_filter = QueryTableFilter( + self.query_filter = QueryCompensationTableFilter( user=user, data=request_data, queryset=qs, @@ -89,7 +101,11 @@ class CheckboxEcoAccountTableFilter(CheckboxTableFilter): method='filter_only_show_unrecorded', label=_("Show only unrecorded"), label_suffix=_(""), - widget=forms.CheckboxInput() + widget=forms.CheckboxInput( + attrs={ + "class": "form-check-input", + } + ) ) def filter_show_all(self, queryset, name, value) -> QuerySet: diff --git a/konova/filters.py b/konova/filters.py index 00445828..1364aeb1 100644 --- a/konova/filters.py +++ b/konova/filters.py @@ -57,6 +57,28 @@ class KeywordTableFilterMixin(django_filters.FilterSet): 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): """ A mixin for AbstractTableFilter @@ -329,7 +351,10 @@ class RecordableTableFilterMixin(django_filters.FilterSet): return queryset -class QueryTableFilter(AbstractTableFilter, KeywordTableFilterMixin, GeoReferencedTableFilterMixin): +class QueryTableFilter(AbstractTableFilter, + KeywordTableFilterMixin, + FileNumberTableFilterMixin, + GeoReferencedTableFilterMixin): """ TableFilter holding different filter options for query related filtering """ diff --git a/locale/de/LC_MESSAGES/django.mo b/locale/de/LC_MESSAGES/django.mo index 65defeed..1246234f 100644 Binary files a/locale/de/LC_MESSAGES/django.mo and b/locale/de/LC_MESSAGES/django.mo differ diff --git a/locale/de/LC_MESSAGES/django.po b/locale/de/LC_MESSAGES/django.po index 453d065d..cb6b2a81 100644 --- a/locale/de/LC_MESSAGES/django.po +++ b/locale/de/LC_MESSAGES/django.po @@ -3,25 +3,26 @@ # This file is distributed under the same license as the PACKAGE package. # FIRST AUTHOR , 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: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:166 intervention/forms/modalForms.py:125 #: 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:77 konova/filters.py:88 konova/filters.py:89 -#: konova/filters.py:100 konova/filters.py:101 konova/filters.py:113 -#: konova/filters.py:114 konova/forms.py:140 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 +#: konova/filters.py:63 konova/filters.py:64 konova/filters.py:91 +#: konova/filters.py:92 konova/filters.py:104 konova/filters.py:105 +#: konova/filters.py:117 konova/filters.py:118 konova/filters.py:130 +#: konova/filters.py:131 konova/filters.py:144 konova/filters.py:145 +#: konova/filters.py:280 konova/filters.py:324 konova/forms.py:140 +#: 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 msgid "" msgstr "" "Project-Id-Version: PACKAGE VERSION\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" "Last-Translator: FULL NAME \n" "Language-Team: LANGUAGE \n" @@ -147,7 +148,7 @@ msgstr "Geprüft" #: analysis/templates/analysis/reports/includes/intervention/compensated_by.html:9 #: analysis/templates/analysis/reports/includes/intervention/laws.html:20 #: 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/eco_account/includes/deductions.html:31 #: 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/old_data/amount.html:29 -#: compensation/tables.py:84 +#: compensation/tables.py:85 #: compensation/templates/compensation/detail/compensation/view.html:19 #: konova/templates/konova/home.html:49 templates/navbars/navbar.html:28 msgid "Compensation" @@ -278,14 +279,14 @@ msgstr "Typ" #: analysis/templates/analysis/reports/includes/old_data/amount.html:24 #: 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 #: konova/templates/konova/home.html:11 templates/navbars/navbar.html:22 msgid "Intervention" msgstr "Eingriff" #: 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 #: intervention/forms/modalForms.py:279 intervention/forms/modalForms.py:286 #: konova/templates/konova/home.html:88 templates/navbars/navbar.html:34 @@ -300,12 +301,12 @@ msgstr "Altfälle" msgid "Before" msgstr "Vor" -#: compensation/filters.py:70 +#: compensation/filters.py:90 msgid "Show only unrecorded" msgstr "Nur unverzeichnete anzeigen" #: 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/templates/intervention/detail/includes/compensations.html:30 msgid "Identifier" @@ -316,7 +317,7 @@ msgid "Generated automatically" msgstr "Automatisch generiert" #: 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/view.html:31 #: 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 " "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 msgid "Editable" 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 msgid "Last edit" msgstr "Zuletzt bearbeitet" -#: compensation/tables.py:84 compensation/tables.py:224 ema/tables.py:82 -#: intervention/tables.py:88 +#: compensation/tables.py:85 compensation/tables.py:226 ema/tables.py:83 +#: intervention/tables.py:89 msgid "Open {}" msgstr "Öffne {}" -#: compensation/tables.py:105 intervention/tables.py:107 +#: compensation/tables.py:106 intervention/tables.py:108 msgid "Not checked yet" 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 {}" 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/eco_account/includes/deductions.html:56 #: compensation/templates/compensation/detail/eco_account/view.html:47 -#: ema/tables.py:101 ema/templates/ema/detail/view.html:38 -#: intervention/tables.py:131 +#: ema/tables.py:102 ema/templates/ema/detail/view.html:38 +#: intervention/tables.py:132 #: intervention/templates/intervention/detail/view.html:85 msgid "Not recorded yet" msgstr "Noch nicht verzeichnet" -#: compensation/tables.py:134 compensation/tables.py:262 ema/tables.py:106 -#: intervention/tables.py:136 +#: compensation/tables.py:135 compensation/tables.py:264 ema/tables.py:107 +#: intervention/tables.py:137 msgid "Recorded on {} by {}" msgstr "Am {} von {} verzeichnet worden" -#: compensation/tables.py:158 compensation/tables.py:284 ema/tables.py:129 -#: intervention/tables.py:159 +#: compensation/tables.py:159 compensation/tables.py:286 ema/tables.py:130 +#: intervention/tables.py:160 msgid "Full access granted" msgstr "Für Sie freigegeben - Datensatz kann bearbeitet werden" -#: compensation/tables.py:158 compensation/tables.py:284 ema/tables.py:129 -#: intervention/tables.py:159 +#: compensation/tables.py:159 compensation/tables.py:286 ema/tables.py:130 +#: intervention/tables.py:160 msgid "Access not granted" msgstr "Nicht freigegeben - Datensatz nur lesbar" -#: compensation/tables.py:176 +#: compensation/tables.py:177 #: compensation/templates/compensation/detail/eco_account/view.html:35 #: konova/templates/konova/widgets/progressbar.html:3 msgid "Available" msgstr "Verfügbar" -#: compensation/tables.py:202 +#: compensation/tables.py:203 msgid "Eco Accounts" msgstr "Ökokonten" -#: compensation/tables.py:257 +#: compensation/tables.py:259 msgid "Not recorded yet. Can not be used for deductions, yet." msgstr "" "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 " "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" msgstr "" @@ -1199,14 +1200,6 @@ msgstr "EMA {} bearbeitet" msgid "EMA removed" 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 msgid "Construction XY; Location ABC" msgstr "Bauvorhaben XY; Flur ABC" @@ -1376,11 +1369,11 @@ msgstr "" msgid "Revocation" msgstr "Widerspruch" -#: intervention/tables.py:176 +#: intervention/tables.py:177 msgid "No revocation" msgstr "Kein Widerspruch" -#: intervention/tables.py:182 +#: intervention/tables.py:183 msgid "Revocation from {}, added on {} by {}" msgstr "Widerspruch vom {}, am {} von {} hinzugefügt" @@ -1515,46 +1508,62 @@ msgstr "" "somit nichts eingeben, bearbeiten oder sonstige Aktionen ausführen. " "Kontaktieren Sie bitte einen Administrator. +++" +#: konova/filters.py:67 +msgid "File number" +msgstr "Aktenzeichen" + #: konova/filters.py:68 +msgid "Search for file number" +msgstr "Nach Aktenzeichen suchen" + +#: konova/filters.py:95 msgid "District" msgstr "Kreis" -#: konova/filters.py:69 +#: konova/filters.py:96 msgid "Search for district" msgstr "Nach Kreis suchen" -#: konova/filters.py:80 +#: konova/filters.py:108 msgid "Parcel gmrkng" msgstr "Gemarkung" -#: konova/filters.py:81 +#: konova/filters.py:109 msgid "Search for parcel gmrkng" 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" msgstr "Flur" -#: konova/filters.py:93 +#: konova/filters.py:122 msgid "Search for parcel" 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" msgstr "Flurstückzähler" -#: konova/filters.py:105 +#: konova/filters.py:135 msgid "Search for parcel counter" 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" msgstr "Flurstücknenner" -#: konova/filters.py:118 +#: konova/filters.py:149 msgid "Search for parcel number" 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 msgid "Save" msgstr "Speichern" @@ -1921,11 +1930,11 @@ msgstr "Starte Suche" msgid "Results per page" 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" msgstr "" -#: templates/generic_index.html:90 +#: templates/generic_index.html:101 msgid "Apply filter" msgstr "Filter anwenden"