-
-
Notifications
You must be signed in to change notification settings - Fork 34
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
Can ordering feature cross relations? #101
Comments
@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 :
|
Oh okay I see what you mean. I will take a look and revert |
Has this bug been fixed? @router.get('/', response=List[SalarySchemaOut], summary='获取研发人员工资-分页')
@paginate(MyPagination)
@ordering(Ordering, ordering_fields=['research_staff_item__item_paper__name'])
def listData(request, filters: SalaryFilterSchema = Query(...)):
""" 获取研发人员工资 """
queryset = ResearchSalary.add_annotate()
queryset = queryset.filter(research_staff_item__research_staff__company=request.company)\
.prefetch_related("research_staff_item", "research_staff_item__research_staff", "research_staff_item__item_paper")
queryset = filters.filter(queryset)
return queryset |
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.
The text was updated successfully, but these errors were encountered: