Skip to content

Commit

Permalink
fix api view generateschema compatibility (#1440)
Browse files Browse the repository at this point in the history
  • Loading branch information
holtgrewe authored Jun 21, 2024
1 parent 00adfbb commit a51f65e
Showing 1 changed file with 6 additions and 0 deletions.
6 changes: 6 additions & 0 deletions projectroles/views_api.py
Original file line number Diff line number Diff line change
@@ -1,5 +1,7 @@
"""REST API views for the projectroles app"""

import sys

from ipaddress import ip_address, ip_network

from django.conf import settings
Expand Down Expand Up @@ -281,6 +283,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

Expand Down Expand Up @@ -573,6 +577,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
Expand Down

0 comments on commit a51f65e

Please sign in to comment.