From 1ccf3571245e0bde0dabc5ee7a2a8edfe4b07843 Mon Sep 17 00:00:00 2001 From: Florian Knappers <73856313+JJFlorian@users.noreply.github.com> Date: Fri, 22 Mar 2024 11:44:55 +0100 Subject: [PATCH] added objectdoesnotexist error to measuringpoint endpoint --- gmn/serializers.py | 9 +++++---- 1 file changed, 5 insertions(+), 4 deletions(-) diff --git a/gmn/serializers.py b/gmn/serializers.py index 8f3012a..5be01d5 100644 --- a/gmn/serializers.py +++ b/gmn/serializers.py @@ -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 @@ -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 @@ -44,4 +45,4 @@ def get_monitoringtube_uuid(self, obj): gmw=gmw_uuid, tube_number=obj.tube_number ).uuid except ObjectDoesNotExist: - return None \ No newline at end of file + return None