Skip to content

Commit

Permalink
fix: use the filter method of the superclass, if it exists
Browse files Browse the repository at this point in the history
Python does not pass the object from one parent classes' method to the
next, we have to call super() ourselves, if the method exists.

Closes: #263
  • Loading branch information
b1rger committed Aug 30, 2023
1 parent 7fbc6e3 commit b96ec9e
Showing 1 changed file with 2 additions and 0 deletions.
2 changes: 2 additions & 0 deletions apis_core/core/mixins.py
Original file line number Diff line number Diff line change
Expand Up @@ -40,6 +40,8 @@ class ListViewObjectFilterMixin:
"""

def filter_queryset(self, queryset):
if hasattr(super(), "filter_queryset"):
queryset = super().filter_queryset(queryset)
if hasattr(settings, "APIS_LIST_VIEW_OBJECT_FILTER"):
return settings.APIS_LIST_VIEW_OBJECT_FILTER(self, queryset)
return queryset

0 comments on commit b96ec9e

Please sign in to comment.