diff options
| author | Tom Christie | 2014-09-03 16:33:42 +0100 |
|---|---|---|
| committer | Tom Christie | 2014-09-03 16:33:42 +0100 |
| commit | 560f428e24c7676c660114c2daa6017ff61074ad (patch) | |
| tree | c4d7a99a9097589d2a92e0bf9dbc7e71189d8442 /rest_framework/pagination.py | |
| parent | b40525d8e6b3b4839c61053bc1613843d5b8b63d (diff) | |
| parent | afe9b37f600ba7dad9de249f56ea1e7c539939f7 (diff) | |
| download | django-rest-framework-560f428e24c7676c660114c2daa6017ff61074ad.tar.bz2 | |
Merge pull request #1826 from swistakm/fix/explicit-many-in-pagination-serializer-results
Use explicit `many=True` in PaginationSerializer on `object_serializer` instantiation
Diffstat (limited to 'rest_framework/pagination.py')
| -rw-r--r-- | rest_framework/pagination.py | 9 |
1 files changed, 6 insertions, 3 deletions
diff --git a/rest_framework/pagination.py b/rest_framework/pagination.py index d51ea929..1f5749f1 100644 --- a/rest_framework/pagination.py +++ b/rest_framework/pagination.py @@ -43,8 +43,9 @@ class DefaultObjectSerializer(serializers.Field): as the default. """ - def __init__(self, source=None, context=None): - # Note: Swallow context kwarg - only required for eg. ModelSerializer. + def __init__(self, source=None, many=None, context=None): + # Note: Swallow context and many kwargs - only required for + # eg. ModelSerializer. super(DefaultObjectSerializer, self).__init__(source=source) @@ -82,7 +83,9 @@ class BasePaginationSerializer(serializers.Serializer): else: context_kwarg = {} - self.fields[results_field] = object_serializer(source='object_list', **context_kwarg) + self.fields[results_field] = object_serializer(source='object_list', + many=True, + **context_kwarg) class PaginationSerializer(BasePaginationSerializer): |
