Skip to content

Commit

Permalink
added objectdoesnotexist error to measuringpoint endpoint
Browse files Browse the repository at this point in the history
  • Loading branch information
JJFlorian committed Mar 22, 2024
1 parent 608a8fa commit 1ccf357
Showing 1 changed file with 5 additions and 4 deletions.
9 changes: 5 additions & 4 deletions gmn/serializers.py
Original file line number Diff line number Diff line change
@@ -1,6 +1,5 @@
from rest_framework import serializers
from django.core.exceptions import ObjectDoesNotExist

from rest_framework import serializers

from api.mixins import RequiredFieldsMixin, UrlFieldMixin
from gmw import models as gmw_models
Expand All @@ -27,7 +26,9 @@ class Meta:

def get_location(self, obj):
try:
return gmw_models.GMW.objects.get(bro_id=obj.gmw_bro_id).standardized_location
return gmw_models.GMW.objects.get(
bro_id=obj.gmw_bro_id
).standardized_location
except ObjectDoesNotExist:
return None

Expand All @@ -44,4 +45,4 @@ def get_monitoringtube_uuid(self, obj):
gmw=gmw_uuid, tube_number=obj.tube_number
).uuid
except ObjectDoesNotExist:
return None
return None

0 comments on commit 1ccf357

Please sign in to comment.