Skip to content

Commit

Permalink
Merge pull request #2 from sobadgirl/feat-permission-chain
Browse files Browse the repository at this point in the history
  • Loading branch information
sobadgirl authored Apr 24, 2022
2 parents 5c92e9b + fb2b442 commit 27eb8e9
Showing 1 changed file with 5 additions and 3 deletions.
8 changes: 5 additions & 3 deletions rest_framework_extensions/mixins.py
Original file line number Diff line number Diff line change
Expand Up @@ -122,11 +122,13 @@ def check_parent_object_permissions(self, request):
return
current_model = self.get_queryset().model
# TODO
# 1. for model__submodel case.
# 1. for model__submodel case(Done).
# 2. for generic relations case.
for parent_model_lookup_name, parent_model_lookup_value in reversed(parents_query_dict.items()):
parent_model = current_model._meta.get_field(
parent_model_lookup_name).related_model
parent_model = current_model
for lookup_name in parent_model_lookup_name.split("__"):
parent_model = parent_model._meta.get_field(
lookup_name).related_model
for parent_viewset_class in self.parent_viewsets:
parent_viewset = parent_viewset_class()
parent_viewset_model = getattr(
Expand Down

0 comments on commit 27eb8e9

Please sign in to comment.