Skip to content

Commit

Permalink
add extra fields to gdpr api serialization
Browse files Browse the repository at this point in the history
  • Loading branch information
henrinie-nc authored and NC-jsAhonen committed Nov 21, 2024
1 parent bf0f4ec commit 23a2f2b
Show file tree
Hide file tree
Showing 2 changed files with 13 additions and 1 deletion.
13 changes: 12 additions & 1 deletion plotsearch/models/plot_search.py
Original file line number Diff line number Diff line change
Expand Up @@ -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",
]
Expand Down Expand Up @@ -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 = [
Expand Down Expand Up @@ -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",
Expand Down
1 change: 1 addition & 0 deletions users/models.py
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down

0 comments on commit 23a2f2b

Please sign in to comment.