From d298b7c373276e7bda8da3a3ee943802f67669f0 Mon Sep 17 00:00:00 2001 From: fuzzylogic2000 Date: Mon, 7 Jun 2021 13:47:13 +0200 Subject: [PATCH] bplan/serializer: fix sentry errors and a warning sentry: https://sentry.liqd.net/organizations/liqd/issues/1476/?project=24 https://sentry.liqd.net/organizations/liqd/issues/1477/?project=24 warning: `UnorderedObjectListWarning: Pagination may yield inconsistent results with an unordered object_list: QuerySet.` --- bplan/migrations/0006_add_ordering_to_bplan.py | 17 +++++++++++++++++ bplan/models.py | 1 + bplan/serializers.py | 1 + django_zbp/settings/base.py | 1 + 4 files changed, 20 insertions(+) create mode 100644 bplan/migrations/0006_add_ordering_to_bplan.py diff --git a/bplan/migrations/0006_add_ordering_to_bplan.py b/bplan/migrations/0006_add_ordering_to_bplan.py new file mode 100644 index 00000000..bc53dc36 --- /dev/null +++ b/bplan/migrations/0006_add_ordering_to_bplan.py @@ -0,0 +1,17 @@ +# Generated by Django 2.2.20 on 2021-06-07 11:52 + +from django.db import migrations + + +class Migration(migrations.Migration): + + dependencies = [ + ('bplan', '0005_remove_old_fields_from_bplan_model'), + ] + + operations = [ + migrations.AlterModelOptions( + name='bplan', + options={'ordering': ['id']}, + ), + ] diff --git a/bplan/models.py b/bplan/models.py index 344da31d..8151444c 100644 --- a/bplan/models.py +++ b/bplan/models.py @@ -86,3 +86,4 @@ def __str__(self): class Meta: index_together = [["bbg_anfang", "bbg_ende"], ["aul_anfang", "aul_ende"]] + ordering = ['id'] diff --git a/bplan/serializers.py b/bplan/serializers.py index fa73ff67..3c23a168 100644 --- a/bplan/serializers.py +++ b/bplan/serializers.py @@ -155,5 +155,6 @@ class BPlanSerializer(SimpleBPlanSerializer, GeoFeatureModelSerializer): class Meta: model = BPlan + fields = '__all__' id_field = False geo_field = 'multipolygon' diff --git a/django_zbp/settings/base.py b/django_zbp/settings/base.py index b1dacab6..e8463ee5 100644 --- a/django_zbp/settings/base.py +++ b/django_zbp/settings/base.py @@ -37,6 +37,7 @@ 'django.contrib.messages', 'django.contrib.staticfiles', 'django.contrib.gis', + 'django_filters', 'rest_framework', 'rest_framework_gis', 'bplan',