Harden search filter

* hardens search filter against whitespaces
* renames 'Show all' filter to 'Show unshared' for clarification
* adds translation
This commit is contained in:
mipel 2021-07-28 08:54:48 +02:00
parent d919eee3b4
commit 1d77eb293e
3 changed files with 8 additions and 4 deletions

View File

@ -21,7 +21,7 @@ class InterventionTableFilter(django_filters.FilterSet):
) )
sa = django_filters.BooleanFilter( sa = django_filters.BooleanFilter(
method='_filter_show_all', method='_filter_show_all',
label=_("Show all"), label=_("Show unshared"),
label_suffix=_(""), label_suffix=_(""),
widget=forms.CheckboxInput() widget=forms.CheckboxInput()
) )
@ -72,6 +72,7 @@ class InterventionTableFilter(django_filters.FilterSet):
Returns: Returns:
""" """
value = value.strip()
# build filter expression # build filter expression
q = Q(title__icontains=value) | Q(identifier__icontains=value) q = Q(title__icontains=value) | Q(identifier__icontains=value)
return queryset.filter(q) return queryset.filter(q)

Binary file not shown.

View File

@ -13,7 +13,7 @@ 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: 2021-07-28 08:48+0200\n" "POT-Creation-Date: 2021-07-28 08:51+0200\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"
@ -122,8 +122,8 @@ msgid "Payment removed"
msgstr "Zahlung gelöscht" msgstr "Zahlung gelöscht"
#: intervention/filters.py:24 #: intervention/filters.py:24
msgid "Show all" msgid "Show unshared"
msgstr "Alle anzeigen" msgstr "Nicht freigegebene anzeigen"
#: intervention/filters.py:30 #: intervention/filters.py:30
msgid "Show recorded" msgid "Show recorded"
@ -1866,6 +1866,9 @@ msgstr ""
msgid "A fontawesome icon field" msgid "A fontawesome icon field"
msgstr "" msgstr ""
#~ msgid "Show all"
#~ msgstr "Alle anzeigen"
#~ msgid "This will remove '{}'. Are you sure?" #~ msgid "This will remove '{}'. Are you sure?"
#~ msgstr "Hiermit wird '{}' gelöscht. Sind Sie sicher?" #~ msgstr "Hiermit wird '{}' gelöscht. Sind Sie sicher?"