Skip to content

Commit

Permalink
πŸ› request is not available when called from manage.py generateschema
Browse files Browse the repository at this point in the history
  • Loading branch information
krmax44 committed Nov 18, 2024
1 parent 33c88e1 commit 3e7a8cc
Showing 1 changed file with 3 additions and 1 deletion.
4 changes: 3 additions & 1 deletion src/filingcabinet/api_views.py
Original file line number Diff line number Diff line change
Expand Up @@ -189,7 +189,9 @@ def get_serializer_context(self):
try:
dir_id = int(self.request.GET.get("directory", ""))
parent_directory = CollectionDirectory.objects.get(id=dir_id)
except (ValueError, CollectionDirectory.DoesNotExist):
except (ValueError, CollectionDirectory.DoesNotExist, AttributeError):
# request is not available when called from manage.py generateschema
# request.GET therefore raises an AttributeError
parent_directory = None

ctx.update({"parent_directory": parent_directory})
Expand Down

0 comments on commit 3e7a8cc

Please sign in to comment.