-
-
Notifications
You must be signed in to change notification settings - Fork 7k
Closed
Description
Example of usage would be sorting by a nested related object.
Nested representation:
{
'username': 'george',
'email': 'george@example.com'
'stats': {
'facebook_friends': 560,
'twitter_followers': 4043,
...
},
},
{
'username': 'michael',
'email': 'michael@example.com'
'stats': {
'facebook_friends': 256,
'twitter_followers': 120,
...
},
},
...
One option is to support the django orm double underscore notation __ for related models.
Ex. ?ordering=stats__facebook_friends
would sort by facebook_friends.
Currently ordering only works for fields of the particular model specified in queryset.
https://github.com/tomchristie/django-rest-framework/blob/master/rest_framework/filters.py#L125
sushain97, ArturBaybulatov, fdemmer and faizan-py
Metadata
Metadata
Assignees
Labels
No labels