Skip to content

Commit

Permalink
area search public serializer: remove unnecessary data from output
Browse files Browse the repository at this point in the history
  • Loading branch information
NC-jsAhonen committed Jan 27, 2025
1 parent 6eb8c62 commit 7cde77f
Show file tree
Hide file tree
Showing 2 changed files with 10 additions and 0 deletions.
8 changes: 8 additions & 0 deletions plotsearch/serializers/plot_search.py
Original file line number Diff line number Diff line change
Expand Up @@ -840,6 +840,14 @@ def create(self, validated_data):
return attachment


class AreaSearchAttachmentPublicSerializer(AreaSearchAttachmentSerializer):
def to_representation(self, instance):
representation = super().to_representation(instance)
for key in ["attachment", "user", "area_search", "created_at"]:
representation.pop(key)
return representation


class AreaSearchStatusNoteSerializer(serializers.ModelSerializer):
preparer = UserSerializer(read_only=True)
time_stamp = serializers.DateTimeField(read_only=True)
Expand Down
2 changes: 2 additions & 0 deletions plotsearch/views/plot_search.py
Original file line number Diff line number Diff line change
Expand Up @@ -64,6 +64,7 @@
PlotSearchOpeningRecordPermissions,
)
from plotsearch.serializers.plot_search import (
AreaSearchAttachmentPublicSerializer,
AreaSearchAttachmentSerializer,
AreaSearchDetailSerializer,
AreaSearchListSerializer,
Expand Down Expand Up @@ -411,6 +412,7 @@ class AreaSearchAttachmentPublicViewset(
):
"""Includes FileExtensionFileMixin to validate file extensions."""

serializer_class = AreaSearchAttachmentPublicSerializer
permission_classes = (AreaSearchAttachmentPublicPermissions,)

def destroy(self, request, *args, **kwargs):
Expand Down

0 comments on commit 7cde77f

Please sign in to comment.