diff options
| author | Tom Christie | 2012-11-07 21:09:26 +0000 |
|---|---|---|
| committer | Tom Christie | 2012-11-07 21:09:26 +0000 |
| commit | 30799a3955b3b13ae0d40791f1260f05bda438be (patch) | |
| tree | 4def4c71738679b4b9531437d984f13a95f3e4e2 | |
| parent | 47b534a13e42d498629bf9522225633122c563d5 (diff) | |
| download | django-rest-framework-30799a3955b3b13ae0d40791f1260f05bda438be.tar.bz2 | |
Simplify NextPageField and PreviousPageField slightly
| -rw-r--r-- | rest_framework/pagination.py | 12 |
1 files changed, 6 insertions, 6 deletions
diff --git a/rest_framework/pagination.py b/rest_framework/pagination.py index aa54d154..5df3940a 100644 --- a/rest_framework/pagination.py +++ b/rest_framework/pagination.py @@ -4,14 +4,12 @@ from rest_framework.templatetags.rest_framework import replace_query_param # TODO: Support URLconf kwarg-style paging -class PageField(serializers.Field): - page_field = 'page' - - -class NextPageField(PageField): +class NextPageField(serializers.Field): """ Field that returns a link to the next page in paginated results. """ + page_field = 'page' + def to_native(self, value): if not value.has_next(): return None @@ -21,10 +19,12 @@ class NextPageField(PageField): return replace_query_param(url, self.page_field, page) -class PreviousPageField(PageField): +class PreviousPageField(serializers.Field): """ Field that returns a link to the previous page in paginated results. """ + page_field = 'page' + def to_native(self, value): if not value.has_previous(): return None |
