diff --git a/stude/study_groups/serializers.py b/stude/study_groups/serializers.py index 9282c51..1c50ce1 100644 --- a/stude/study_groups/serializers.py +++ b/stude/study_groups/serializers.py @@ -62,7 +62,6 @@ class StudyGroupDistanceSerializer(serializers.ModelSerializer): location = PointField() landmark = serializers.SlugRelatedField( queryset=Landmark.objects.all(), many=False, slug_field='name', required=False, allow_null=True) - radius = serializers.FloatField() distance = serializers.SerializerMethodField(default=0) class Meta: @@ -77,7 +76,8 @@ class StudyGroupDistanceSerializer(serializers.ModelSerializer): def to_representation(self, instance): representation = super().to_representation(instance) - representation['distance'] = 10 + representation['distance'] = self.get_distance(instance) + representation['radius'] = 15 return representation diff --git a/stude/study_groups/views.py b/stude/study_groups/views.py index 2ac1632..5f25656 100644 --- a/stude/study_groups/views.py +++ b/stude/study_groups/views.py @@ -120,9 +120,6 @@ class StudyGroupListNearView(generics.ListAPIView): studygroups = StudyGroup.objects.filter(subject__in=user_subjects).annotate( distance=Distance('location', user_location)).filter(distance__lte=100) - for group in studygroups: - # Annotate the group with the radius - group.radius = 30 return studygroups