-
Notifications
You must be signed in to change notification settings - Fork 76
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Sorting support #10
Comments
I'm using this mixin for ordering. class QueryOrderableViewSetMixin(object):
def get_queryset(self):
queryset = super(QueryOrderableViewSetMixin, self).get_queryset()
try:
order_by = self.request.query_params['order_by']
return queryset.order_by(*order_by.split(','))
except KeyError:
return queryset |
Is there a particular reason that DRF's built in ordering filter_backend fails in conjunction with using Django URL filter? Here is my class-based view:
I am using DjangoFilterBackend, my own OpportunityFilterBackend to restrict querysets based on the user type, and filters.OrderingFilter to provide ordering support. However, ordering does not seem to work at all. Where does one employ the mixin used above? |
I'm really interested in this feature as well. |
Having form validate all of the query data, might as well add ordering support.
The text was updated successfully, but these errors were encountered: