Skip to content

Commit

Permalink
Remove species_id from SensitiveArea's mobile API serializer
Browse files Browse the repository at this point in the history
  • Loading branch information
justinefricou committed Feb 11, 2025
1 parent ba50d64 commit 2967035
Showing 1 changed file with 1 addition and 7 deletions.
8 changes: 1 addition & 7 deletions geotrek/api/mobile/serializers/sensitivity.py
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,6 @@ class SensitiveAreaListSerializer(geo_serializers.GeoFeatureModelSerializer):
geometry = geo_serializers.GeometryField(read_only=True, precision=7, source='geom2d_transformed')
name = serializers.ReadOnlyField(source='species.name')
description = serializers.ReadOnlyField()
species_id = serializers.SerializerMethodField(source='species.pk')
practices = serializers.PrimaryKeyRelatedField(many=True, source='species.practices', read_only=True)
info_url = serializers.URLField(source='species.url')
period = serializers.SerializerMethodField()
Expand All @@ -20,14 +19,9 @@ class Meta:
id_field = 'pk'
geo_field = 'geometry'
fields = (
'id', 'pk', 'name', 'description', 'species_id', 'practices',
'id', 'pk', 'name', 'description', 'practices',
'contact', 'info_url', 'period', 'geometry',
)

def get_species_id(self, obj):
if obj.species.category == sensitivity_models.Species.SPECIES:
return obj.species_id
return None

def get_period(self, obj):
return [getattr(obj.species, 'period{:02}'.format(p)) for p in range(1, 13)]

0 comments on commit 2967035

Please sign in to comment.