Skip to content

Commit

Permalink
Update viewsets.py
Browse files Browse the repository at this point in the history
From #149
Fixes exception in drf-yasg / django-rest-swagger
  • Loading branch information
Moulde committed Apr 16, 2020
1 parent b78d095 commit 5ed836d
Showing 1 changed file with 1 addition and 1 deletion.
2 changes: 1 addition & 1 deletion rest_framework_nested/viewsets.py
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@ def get_queryset(self):
"""
queryset = super(NestedViewSetMixin, self).get_queryset()
serializer_class = self.get_serializer_class()
if hasattr(serializer_class, 'parent_lookup_kwargs'):
if hasattr(serializer_class, 'parent_lookup_kwargs') and hasattr(self, 'kwargs') and self.kwargs:
orm_filters = {}
for query_param, field_name in serializer_class.parent_lookup_kwargs.items():
orm_filters[field_name] = self.kwargs[query_param]
Expand Down

0 comments on commit 5ed836d

Please sign in to comment.