Fixed landmarks not being properly saved on study group creation

This commit is contained in:
Keannu Bernasol 2023-11-24 00:13:41 +08:00
parent 832283f029
commit e9bf93da4a

View file

@ -101,6 +101,8 @@ class StudyGroupCreateSerializer(serializers.ModelSerializer):
for landmark in Landmark.objects.all(): for landmark in Landmark.objects.all():
if landmark.location.contains(validated_data['location']): if landmark.location.contains(validated_data['location']):
validated_data['landmark'] = landmark validated_data['landmark'] = landmark
study_group.landmark = landmark
study_group.save()
break break
validated_data['location'].read_only = True validated_data['location'].read_only = True
return study_group return study_group