diff --git a/projectroles/views_api.py b/projectroles/views_api.py index 54fbf1a8..b473382f 100644 --- a/projectroles/views_api.py +++ b/projectroles/views_api.py @@ -1,6 +1,7 @@ """REST API views for the projectroles app""" import re +import sys from ipaddress import ip_address, ip_network @@ -257,6 +258,8 @@ class APIProjectContextMixin(ProjectAccessMixin): def get_serializer_context(self, *args, **kwargs): context = super().get_serializer_context(*args, **kwargs) + if sys.argv[1:2] == ["generateschema"]: + return context context['project'] = self.get_project(request=context['request']) return context @@ -502,6 +505,8 @@ class ProjectUpdateAPIView( def get_serializer_context(self, *args, **kwargs): context = super().get_serializer_context(*args, **kwargs) + if sys.argv[1:2] == ["generateschema"]: + return context project = self.get_project(request=context['request']) context['parent'] = ( str(project.parent.sodar_uuid) if project.parent else None