Skip to content

Commit

Permalink
Fix issue with class MRO
Browse files Browse the repository at this point in the history
  • Loading branch information
AlanCoding committed May 8, 2024
1 parent f6d23e2 commit cdf4303
Show file tree
Hide file tree
Showing 2 changed files with 5 additions and 3 deletions.
5 changes: 4 additions & 1 deletion ansible_base/lib/routers/association_resource_router.py
Original file line number Diff line number Diff line change
Expand Up @@ -141,7 +141,10 @@ def get_association_queryset(self) -> QuerySet:
qs = cls.objects.all()

if self.action == 'associate':
return self.filter_queryset(qs)
if hasattr(self, 'filter_associate_queryset'):
return self.filter_associate_queryset(qs)
else:
return self.filter_queryset(qs)
return qs

def get_serializer_class(self):
Expand Down
3 changes: 1 addition & 2 deletions test_app/router.py
Original file line number Diff line number Diff line change
Expand Up @@ -17,9 +17,8 @@ def filter_queryset(self, qs):
"Do not filter users for the related list view, /organizations/42/users/"
return self.apply_optimizations(qs)

def get_association_queryset(self):
def filter_associate_queryset(self, qs):
"Use RBAC filter when associating new users, /organizations/42/users/associate/"
qs = super.get_assocation_queryset()
return super().filter_queryset(qs)


Expand Down

0 comments on commit cdf4303

Please sign in to comment.