#228 Parcel filter

* changes parcel related filter fields from CharField to NumberField to avoid unexpected behaviour on non-numerical input
This commit is contained in:
mpeltriaux 2022-11-16 13:18:52 +01:00
parent eb2d01eeea
commit deb97fbbf3

View File

@ -46,7 +46,7 @@ class GeoReferencedTableFilterMixin(django_filters.FilterSet):
), ),
) )
# Parcel # Parcel
p = django_filters.CharFilter( p = django_filters.NumberFilter(
method="filter_parcel", method="filter_parcel",
label=_(""), label=_(""),
label_suffix=_(""), label_suffix=_(""),
@ -59,7 +59,7 @@ class GeoReferencedTableFilterMixin(django_filters.FilterSet):
), ),
) )
# Parcel counter # Parcel counter
pc = django_filters.CharFilter( pc = django_filters.NumberFilter(
method="filter_parcel_counter", method="filter_parcel_counter",
label=_(""), label=_(""),
label_suffix=_(""), label_suffix=_(""),
@ -73,7 +73,7 @@ class GeoReferencedTableFilterMixin(django_filters.FilterSet):
) )
# Parcel counter # Parcel counter
pn = django_filters.CharFilter( pn = django_filters.NumberFilter(
method="filter_parcel_number", method="filter_parcel_number",
label=_(""), label=_(""),
label_suffix=_(""), label_suffix=_(""),
@ -165,7 +165,6 @@ class GeoReferencedTableFilterMixin(django_filters.FilterSet):
Returns: Returns:
""" """
value = value.replace("-", "")
queryset = self._filter_parcel_reference( queryset = self._filter_parcel_reference(
queryset, queryset,
Q(flr=value), Q(flr=value),
@ -183,7 +182,6 @@ class GeoReferencedTableFilterMixin(django_filters.FilterSet):
Returns: Returns:
""" """
value = value.replace("-", "")
queryset = self._filter_parcel_reference( queryset = self._filter_parcel_reference(
queryset, queryset,
Q(flrstck_zhlr=value) Q(flrstck_zhlr=value)
@ -201,7 +199,6 @@ class GeoReferencedTableFilterMixin(django_filters.FilterSet):
Returns: Returns:
""" """
value = value.replace("-", "")
queryset = self._filter_parcel_reference( queryset = self._filter_parcel_reference(
queryset, queryset,
Q(flrstck_nnr=value), Q(flrstck_nnr=value),