From 266f2fcdf6ed6c21a187df8581018156e64e5724 Mon Sep 17 00:00:00 2001 From: mpeltriaux Date: Wed, 16 Nov 2022 13:18:52 +0100 Subject: [PATCH] #228 Parcel filter * changes parcel related filter fields from CharField to NumberField to avoid unexpected behaviour on non-numerical input --- konova/filters/mixins/geo_reference.py | 9 +++------ 1 file changed, 3 insertions(+), 6 deletions(-) diff --git a/konova/filters/mixins/geo_reference.py b/konova/filters/mixins/geo_reference.py index eacf5c5b..71fa41f5 100644 --- a/konova/filters/mixins/geo_reference.py +++ b/konova/filters/mixins/geo_reference.py @@ -46,7 +46,7 @@ class GeoReferencedTableFilterMixin(django_filters.FilterSet): ), ) # Parcel - p = django_filters.CharFilter( + p = django_filters.NumberFilter( method="filter_parcel", label=_(""), label_suffix=_(""), @@ -59,7 +59,7 @@ class GeoReferencedTableFilterMixin(django_filters.FilterSet): ), ) # Parcel counter - pc = django_filters.CharFilter( + pc = django_filters.NumberFilter( method="filter_parcel_counter", label=_(""), label_suffix=_(""), @@ -73,7 +73,7 @@ class GeoReferencedTableFilterMixin(django_filters.FilterSet): ) # Parcel counter - pn = django_filters.CharFilter( + pn = django_filters.NumberFilter( method="filter_parcel_number", label=_(""), label_suffix=_(""), @@ -165,7 +165,6 @@ class GeoReferencedTableFilterMixin(django_filters.FilterSet): Returns: """ - value = value.replace("-", "") queryset = self._filter_parcel_reference( queryset, Q(flr=value), @@ -183,7 +182,6 @@ class GeoReferencedTableFilterMixin(django_filters.FilterSet): Returns: """ - value = value.replace("-", "") queryset = self._filter_parcel_reference( queryset, Q(flrstck_zhlr=value) @@ -201,7 +199,6 @@ class GeoReferencedTableFilterMixin(django_filters.FilterSet): Returns: """ - value = value.replace("-", "") queryset = self._filter_parcel_reference( queryset, Q(flrstck_nnr=value),