Skip to content
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

Add support to query builder for creating sort arguments #14

Closed
anthonyjb opened this issue Jul 19, 2017 · 1 comment
Closed

Add support to query builder for creating sort arguments #14

anthonyjb opened this issue Jul 19, 2017 · 1 comment
Assignees

Comments

@anthonyjb
Copy link
Member

At the moment to specify the order of a set of results we'd do something like:

articles = Ariticle.many(sort=[('publish_date', DESC), ('title', ASC)])

I think it would be a useful addition to the query builder if we would instead build these sort lists along the lines that we build queries, e.g:

articles = Ariticle.many(sort=[Q.publish_date.desc, Q.title])
@anthonyjb anthonyjb self-assigned this Jul 19, 2017
@anthonyjb
Copy link
Member Author

This functionality is now supported using the SortBy function, for example:

articles = Ariticle.many(sort=SortBy(Q.publish_date.desc, Q.title))

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

1 participant