To do `GROUP_BY` queries in django requires one to use `.values()` eg this groups posts by user getting a count of posts per user. ``` Posts.objects.order_by('user').values('user').annotate(post_count=Count('post')) ``` This would produce a value queryset which serializes its result objects as dictionaries while `CursorPagination` requires a queryset with result objects that are model instances. This commit enables cursor pagination for value querysets. - had to mangle the tests a bit to test it out. They might need some refactoring. - tried the same for `.values_list()` but it turned out to be trickier than I expected since you have to use tuple indexes.
Name |
Last commit
|
Last update |
---|---|---|
.. | ||
authtoken | Loading commit data... | |
locale | Loading commit data... | |
static/rest_framework | Loading commit data... | |
templates/rest_framework | Loading commit data... | |
templatetags | Loading commit data... | |
utils | Loading commit data... | |
__init__.py | Loading commit data... | |
authentication.py | Loading commit data... | |
compat.py | Loading commit data... | |
decorators.py | Loading commit data... | |
exceptions.py | Loading commit data... | |
fields.py | Loading commit data... | |
filters.py | Loading commit data... | |
generics.py | Loading commit data... | |
metadata.py | Loading commit data... | |
mixins.py | Loading commit data... | |
models.py | Loading commit data... | |
negotiation.py | Loading commit data... | |
pagination.py | Loading commit data... | |
parsers.py | Loading commit data... | |
permissions.py | Loading commit data... | |
relations.py | Loading commit data... | |
renderers.py | Loading commit data... | |
request.py | Loading commit data... | |
response.py | Loading commit data... | |
reverse.py | Loading commit data... | |
routers.py | Loading commit data... | |
schemas.py | Loading commit data... | |
serializers.py | Loading commit data... | |
settings.py | Loading commit data... | |
status.py | Loading commit data... | |
test.py | Loading commit data... | |
throttling.py | Loading commit data... | |
urlpatterns.py | Loading commit data... | |
urls.py | Loading commit data... | |
validators.py | Loading commit data... | |
versioning.py | Loading commit data... | |
views.py | Loading commit data... | |
viewsets.py | Loading commit data... |