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

Polymorphic order_by #518

Open
jahnagoldman opened this issue May 5, 2022 · 0 comments
Open

Polymorphic order_by #518

jahnagoldman opened this issue May 5, 2022 · 0 comments

Comments

@jahnagoldman
Copy link

In the documentation, it's mentioned you can use Q objects for filtering by different fields i.e.

items.filter(
    Q(ModelA___field1 = 4) |
    Q(ModelB___field2 = 4) |
    Q(ModelC___field3 = 4)
)

and then mentions order_by() similarly supports the ModelX___field syntax for specifying ordering through a field in a submodel.

What's the correct syntax for using order_by with different fields on each model? I personally wasn't able to get anything to work properly. Thanks so much!

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

No branches or pull requests

1 participant