#34960 closed Cleanup/optimization (wontfix)

Document how to set nulls_last=True for admin_order_field/ordering

Reported by: Petr Dlouhý Owned by: nobody
Component: Documentation Version: 4.2
Severity: Normal Keywords:
Cc: Triage Stage: Unreviewed
Has patch: no Needs documentation: no
Needs tests: no Patch needs improvement: no
Easy pickings: no UI/UX: no

Description

Django in https://code.djangoproject.com/ticket/30981 added possibility to set nulls_last=True for field ordering in ModelAdmin as:

my_model_admin.admin_order_field = F('field').desc(nulls_last=True)

or

@admin.display(ordering=F('field').desc(nulls_last=True))

but I can't any mention of it at https://docs.djangoproject.com/en/4.2/ref/contrib/admin/.
In fact I had to find the original issue I report it to set this up correctly.

Would it be possible to mention all possible values of admin_order_field/ordering in the documentation?

Change History (1)

comment:1 by Mariusz Felisiak, 12 months ago

Resolution: wontfix
Status: newclosed
Type: New featureCleanup/optimization

Thanks for the ticket. #30981 fixed a bug, not added a new feature. All database expressions can be used in ordering and it's not an admin-specific feature. Moreover, docs already explain how to sort NULLs in a few places:

some of them are reference in the Admin docs. I don't think it's worth mentioning in the next place.

Note: See TracTickets for help on using tickets.
Back to Top