django-ninja-extra
django-ninja-extra copied to clipboard
Can ordering feature cross relations?
Hi there!
I used searching feature and was pleased to notice that search fields can cross relationships, for example with:
@searching(Searching, search_fields=["owner__first_name", "owner__last_name"])
However, I'm wondering how to have a similar behaviour with ordering feature.
As of now, it seems that it is considered to be a wrong field. For example, something like this will have no effect on ordering:
How can I do? Thanks a lot.
@ddahan you mean you want searching query for and ordering action?
Nope, I just want to be able to "order_by" across relation.
For example, this would work in a shell:
Badge.objects.order_by("owner__first_name")
But would not work (no effect on ordering) with my api call to :
http://localost:8000/api/badges?page=1&ordering=owner__first_name
Oh okay I see what you mean. I will take a look and revert