From 9c9ea338609b60b4b4c8079523990f5742dce4e9 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?C=C3=A9dric=20Farcy?= Date: Mon, 13 Nov 2023 11:59:38 +0100 Subject: [PATCH 1/4] Add model type and status to source filterset --- project/geosource/filtersets.py | 8 +++++++- 1 file changed, 7 insertions(+), 1 deletion(-) diff --git a/project/geosource/filtersets.py b/project/geosource/filtersets.py index 59933a64..9a35c56d 100644 --- a/project/geosource/filtersets.py +++ b/project/geosource/filtersets.py @@ -8,4 +8,10 @@ class SourceFilterSet(filters.FilterSet): class Meta: model = Source - fields = ("polymorphic_ctype", "geom_type", "q") + fields = ( + "polymorphic_ctype", + "polymorphic_ctype__model", + "geom_type", + "q", + "status", + ) From 33c44a9a87cd50c6747e585fe9c45018f5690e65 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?C=C3=A9dric=20Farcy?= Date: Mon, 13 Nov 2023 14:36:10 +0100 Subject: [PATCH 2/4] Add report status to sourcefilterset --- project/geosource/filtersets.py | 1 + 1 file changed, 1 insertion(+) diff --git a/project/geosource/filtersets.py b/project/geosource/filtersets.py index 9a35c56d..1f65fd6c 100644 --- a/project/geosource/filtersets.py +++ b/project/geosource/filtersets.py @@ -11,6 +11,7 @@ class Meta: fields = ( "polymorphic_ctype", "polymorphic_ctype__model", + "report__status", "geom_type", "q", "status", From 3c666a594a189d1cf548da52a61452e77b5a7c28 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?C=C3=A9dric=20Farcy=60?= Date: Mon, 11 Dec 2023 15:37:04 +0100 Subject: [PATCH 3/4] changelog --- docs/source/others/changelog.rst | 8 ++++++++ 1 file changed, 8 insertions(+) diff --git a/docs/source/others/changelog.rst b/docs/source/others/changelog.rst index f04686b7..b8c58692 100644 --- a/docs/source/others/changelog.rst +++ b/docs/source/others/changelog.rst @@ -2,6 +2,14 @@ Changelog ========== +2023.11.2+dev (XXX-XX-XX) +--------------------------- + +**Improvements:** + +- Api result for are now filterable by model type and status + + 2023.11.2 (2023-11-22) --------------------------- From f2dd0362bb05598d19ce4617a704c3ba12a40127 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?C=C3=A9dric=20Farcy=60?= Date: Fri, 15 Dec 2023 11:55:53 +0100 Subject: [PATCH 4/4] Allow sorting sources by updated date --- docs/source/others/changelog.rst | 3 ++- project/geosource/serializers.py | 2 ++ project/geosource/views.py | 1 + 3 files changed, 5 insertions(+), 1 deletion(-) diff --git a/docs/source/others/changelog.rst b/docs/source/others/changelog.rst index b8c58692..94aaa4df 100644 --- a/docs/source/others/changelog.rst +++ b/docs/source/others/changelog.rst @@ -7,7 +7,8 @@ Changelog **Improvements:** -- Api result for are now filterable by model type and status +- Api result for sources are now filterable by model type and status +- Api result for sources Sources are now sortable by updated date 2023.11.2 (2023-11-22) diff --git a/project/geosource/serializers.py b/project/geosource/serializers.py index c9b2c060..6502be73 100644 --- a/project/geosource/serializers.py +++ b/project/geosource/serializers.py @@ -172,7 +172,9 @@ class Meta: "name", "geom_type", "report", + "updated_at", ) + extras = {"read_only": {"updated_at": True}} def get__type(self, instance): return instance.__class__.__name__ diff --git a/project/geosource/views.py b/project/geosource/views.py index 6662b3b3..207bb07e 100644 --- a/project/geosource/views.py +++ b/project/geosource/views.py @@ -20,6 +20,7 @@ class SourceModelViewset(ModelViewSet): "geom_type", "id", "slug", + "updated_at", ) filterset_class = SourceFilterSet search_fields = ["name"]