feat: only fetch the location if none is given
This commit is contained in:
@@ -215,8 +215,9 @@ class RescueOrganizationApiView(APIView):
|
|||||||
serializer = RescueOrganizationSerializer(data=request.data, context={"request": request})
|
serializer = RescueOrganizationSerializer(data=request.data, context={"request": request})
|
||||||
if serializer.is_valid():
|
if serializer.is_valid():
|
||||||
rescue_org = serializer.save()
|
rescue_org = serializer.save()
|
||||||
# Add the location
|
if rescue_org.location is None:
|
||||||
post_rescue_org_save.delay_on_commit(rescue_org.pk)
|
# Add the location
|
||||||
|
post_rescue_org_save.delay_on_commit(rescue_org.pk)
|
||||||
return Response(
|
return Response(
|
||||||
{"message": "Rescue organization created successfully!", "id": rescue_org.id},
|
{"message": "Rescue organization created successfully!", "id": rescue_org.id},
|
||||||
status=status.HTTP_201_CREATED,
|
status=status.HTTP_201_CREATED,
|
||||||
|
Reference in New Issue
Block a user