diff --git a/src/objects/config/demo.py b/src/objects/config/demo.py index 47643edc..8155717c 100644 --- a/src/objects/config/demo.py +++ b/src/objects/config/demo.py @@ -28,7 +28,7 @@ def is_configured(self) -> bool: return TokenAuth.objects.filter(token=settings.DEMO_TOKEN).exists() def configure(self): - token_auth, created = TokenAuth.objects.get_or_create( + TokenAuth.objects.update_or_create( token=settings.DEMO_TOKEN, defaults={ "contact_person": settings.DEMO_PERSON, @@ -36,13 +36,6 @@ def configure(self): "is_superuser": True, }, ) - if ( - token_auth.contact_person != settings.DEMO_PERSON - or token_auth.email != settings.DEMO_EMAIL - ): - token_auth.contact_person = settings.DEMO_PERSON - token_auth.email = settings.DEMO_EMAIL - token_auth.save(update_fields=["contact_person", "email"]) def test_configuration(self): endpoint = reverse("v2:object-list") diff --git a/src/objects/config/objecttypes.py b/src/objects/config/objecttypes.py index 480ff67e..1719e21b 100644 --- a/src/objects/config/objecttypes.py +++ b/src/objects/config/objecttypes.py @@ -27,7 +27,7 @@ def is_configured(self) -> bool: return Service.objects.filter(api_root=settings.OBJECTTYPES_API_ROOT).exists() def configure(self) -> None: - service, created = Service.objects.update_or_create( + Service.objects.update_or_create( api_root=settings.OBJECTTYPES_API_ROOT, defaults={ "label": "Objecttypes API", @@ -38,10 +38,6 @@ def configure(self) -> None: "header_value": f"Token {settings.OBJECTS_OBJECTTYPES_TOKEN}", }, ) - if not created: - service.oas = settings.OBJECTTYPES_API_OAS - service.header_value = f"Token {settings.OBJECTS_OBJECTTYPES_TOKEN}" - service.save(update_fields=["oas", "header_value"]) def test_configuration(self) -> None: """