Skip to content

Commit

Permalink
fix docs generation
Browse files Browse the repository at this point in the history
  • Loading branch information
gagantrivedi committed Nov 20, 2024
1 parent d8570bb commit 5c76bd3
Showing 1 changed file with 4 additions and 1 deletion.
5 changes: 4 additions & 1 deletion api/projects/serializers.py
Original file line number Diff line number Diff line change
Expand Up @@ -86,8 +86,11 @@ def get_subscription(self) -> typing.Optional[Subscription]:
# Organisation should only have a single subscription
return Subscription.objects.filter(organisation_id=organisation_id).first()
elif view.action in ("update", "partial_update"):
# handle instance not being set
# When request comes from yasg2 (as part of schema generation)
if not self.instance:
return None
return getattr(self.instance.organisation, "subscription", None)

return None


Expand Down

0 comments on commit 5c76bd3

Please sign in to comment.