Skip to content

Commit

Permalink
fix bug where implicit prefetch and explicit prefetch behaviors were …
Browse files Browse the repository at this point in the history
…inconsistent
  • Loading branch information
Ryo Chijiiwa committed Aug 2, 2019
1 parent 193acee commit c3a6e4c
Showing 1 changed file with 12 additions and 0 deletions.
12 changes: 12 additions & 0 deletions dynamic_rest/filters.py
Original file line number Diff line number Diff line change
Expand Up @@ -518,6 +518,18 @@ def _build_queryset(
requirements
)

# Implicit requirements (i.e. via `requires`) can potentially
# include fields that haven't been explicitly included.
# Such fields would not be in `fields`, so they need to be added.
implicitly_included = set(requirements.keys()) - set(fields.keys())
if implicitly_included:
all_fields = serializer.get_all_fields()
fields.update({
field: all_fields[field]
for field in implicitly_included
if field in all_fields
})

if filters is None:
filters = self._get_requested_filters()

Expand Down

0 comments on commit c3a6e4c

Please sign in to comment.