Skip to content

Commit 9bf415d

Browse files
committed
Fallback to a manually specified results key if no context is provided
1 parent 1d52605 commit 9bf415d

File tree

1 file changed

+4
-4
lines changed

1 file changed

+4
-4
lines changed

rest_framework_ember/pagination.py

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -69,13 +69,13 @@ class EmberPaginationSerializer(pagination.BasePaginationSerializer):
6969
def __init__(self, *args, **kwargs):
7070
super(pagination.BasePaginationSerializer, self).__init__(
7171
*args, **kwargs)
72-
73-
# get the dynamic root key
74-
results_field = get_resource_name(
75-
kwargs.get('context').get('view'))
72+
results_field = self.results_field
7673
object_serializer = self.opts.object_serializer_class
7774

7875
if 'context' in kwargs:
76+
# get the dynamic root key
77+
results_field = get_resource_name(
78+
kwargs.get('context').get('view'))
7979
context_kwarg = {'context': kwargs['context']}
8080
else:
8181
context_kwarg = {}

0 commit comments

Comments
 (0)