From 23a2f2b46602b137f1785ea6d8ed28fcee49b506 Mon Sep 17 00:00:00 2001 From: Henri Nieminen Date: Wed, 20 Nov 2024 12:00:01 +0000 Subject: [PATCH] add extra fields to gdpr api serialization --- plotsearch/models/plot_search.py | 13 ++++++++++++- users/models.py | 1 + 2 files changed, 13 insertions(+), 1 deletion(-) diff --git a/plotsearch/models/plot_search.py b/plotsearch/models/plot_search.py index 5de32db9..187776ed 100755 --- a/plotsearch/models/plot_search.py +++ b/plotsearch/models/plot_search.py @@ -451,6 +451,9 @@ class Meta(NameModel.Meta): verbose_name_plural = pgettext_lazy("Model name", "Area search intended uses") ordering = ["name"] + # GDPR API + serialize_fields = ({"name": "name"},) + recursive_get_related_skip_relations = [ "areasearch", ] @@ -571,8 +574,12 @@ def lessor_name(self): serialize_fields = ( {"name": "address"}, {"name": "received_date"}, + {"name": "start_date"}, + {"name": "end_date"}, # plotsearch.AreaSearchAttachment {"name": "area_search_attachments"}, + # plotsearch.AreaSearchIntendedUse + {"name": "intended_use"}, ) recursive_get_related_skip_relations = [ @@ -627,7 +634,11 @@ class AreaSearchAttachment(SerializableMixin, NameModel): ) # GDPR API - serialize_fields = ({"name": "attachment"}, {"name": "created_at"}) + serialize_fields = ( + {"name": "name"}, + {"name": "attachment"}, + {"name": "created_at"}, + ) recursive_get_related_skip_relations = [ "user", diff --git a/users/models.py b/users/models.py index 5eb0db76..a005b7e1 100644 --- a/users/models.py +++ b/users/models.py @@ -19,6 +19,7 @@ class User(AbstractUser, SerializableMixin): {"name": "first_name"}, {"name": "last_name"}, {"name": "email"}, + {"name": "date_joined"}, # forms.Attachment {"name": "attachment"}, # plotsearch.AreaSearch