Skip to content

Commit

Permalink
Merge pull request #261 from AltSchool/fix/fastquery-implicit-prefetch
Browse files Browse the repository at this point in the history
Fix FastQuery implicit prefetch bug
  • Loading branch information
ryochiji authored Oct 31, 2018
2 parents fabe2ff + cba6d13 commit 2769d4e
Showing 1 changed file with 10 additions and 1 deletion.
11 changes: 10 additions & 1 deletion dynamic_rest/filters.py
Original file line number Diff line number Diff line change
Expand Up @@ -352,10 +352,13 @@ def _build_implicit_prefetches(

return prefetches

def _make_model_queryset(self, model):
return model.objects.all()

def _build_implicit_queryset(self, model, requirements):
"""Build a queryset based on implicit requirements."""

queryset = model.objects.all()
queryset = self._make_model_queryset(model)
prefetches = {}
self._build_implicit_prefetches(
model,
Expand Down Expand Up @@ -620,6 +623,12 @@ def _get_queryset(self, queryset=None, serializer=None):

return queryset

def _make_model_queryset(self, model):
queryset = super(FastDynamicFilterBackend, self)._make_model_queryset(
model
)
return FastQuery(queryset)

def _serializer_filter(self, serializer=None, queryset=None):
queryset.queryset = serializer.filter_queryset(
queryset.queryset
Expand Down

0 comments on commit 2769d4e

Please sign in to comment.