Skip to content

Commit

Permalink
Merge pull request #4072 from GeotrekCE/fix_sorted_attachments_outdoor
Browse files Browse the repository at this point in the history
Sort attachments in API V2 for Outdoor Sites and Touristic Contents (refs #4071)
  • Loading branch information
babastienne committed Apr 15, 2024
2 parents aa572f7 + 6bd3630 commit 68f7821
Show file tree
Hide file tree
Showing 2 changed files with 3 additions and 3 deletions.
2 changes: 1 addition & 1 deletion docs/changelog.rst
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@ CHANGELOG
- Fix crash on migrate when db username or dbname contains dash
- Fix Intervention end date should only be mandatory in last step of Suricate Workflow (refs #3825)"
- Change label filter intervention contractors and filter null value on project contractors detail view (#3820)

- Sort attachements in API V2 for OutdoorSites and TouristicContent objects (fixes #4071)

**Documentation**

Expand Down
4 changes: 2 additions & 2 deletions geotrek/api/v2/serializers.py
Original file line number Diff line number Diff line change
Expand Up @@ -488,7 +488,7 @@ def get_description_teaser(self, obj):
return get_translation_or_dict('description_teaser', self, obj)

class TouristicContentSerializer(TouristicModelSerializer):
attachments = AttachmentSerializer(many=True)
attachments = AttachmentSerializer(many=True, source='sorted_attachments')
departure_city = serializers.SerializerMethodField()
types = serializers.SerializerMethodField()
url = HyperlinkedIdentityField(view_name='apiv2:touristiccontent-detail')
Expand Down Expand Up @@ -1168,7 +1168,7 @@ class SiteSerializer(PDFSerializerMixin, DynamicFieldsMixin, PublishedRelatedObj
period = serializers.SerializerMethodField()
url = HyperlinkedIdentityField(view_name='apiv2:site-detail')
geometry = geo_serializers.GeometryField(read_only=True, source="geom_transformed", precision=7)
attachments = AttachmentSerializer(many=True)
attachments = AttachmentSerializer(many=True, source='sorted_attachments')
sector = serializers.SerializerMethodField()
courses = serializers.SerializerMethodField()
courses_uuids = serializers.SerializerMethodField()
Expand Down

0 comments on commit 68f7821

Please sign in to comment.