#27752: Fix and test admin_order_field set for the __str__ of a model -----------------------------------------+------------------------ Reporter: Claude Paroz | Owner: nobody Type: Bug | Status: new Component: contrib.admin | Version: master Severity: Normal | Keywords: Triage Stage: Accepted | Has patch: 0 Needs documentation: 0 | Needs tests: 0 Patch needs improvement: 0 | Easy pickings: 0 UI/UX: 0 | -----------------------------------------+------------------------ While doing some force_str cleanup on Django 2.0, Tim Graham and me noticed a possible issue with `admin_order_field` on a `__str__`method (in `django.contrib.admin.utils.label_for_field`). It's apparently untested. See this related commit [1], with a test that was later removed [2].
https://github.com/django/django/commit/2304ca423640a7b06390530bf61c879f9ff9e4ba https://github.com/django/django/commit/65cc646c4801e3f3e1df1ab06dfaa763fa4b7b22 So a test for the proper label and sorting is wanted. See `test_change_list_sorting_model_admin` in `tests/admin_views/tests.py` for a similar test. -- Ticket URL: <https://code.djangoproject.com/ticket/27752> Django <https://code.djangoproject.com/> The Web framework for perfectionists with deadlines. -- You received this message because you are subscribed to the Google Groups "Django updates" group. To unsubscribe from this group and stop receiving emails from it, send an email to django-updates+unsubscr...@googlegroups.com. To post to this group, send email to django-updates@googlegroups.com. To view this discussion on the web visit https://groups.google.com/d/msgid/django-updates/050.df1528d2fc0d0f588954f4db0231b3a9%40djangoproject.com. For more options, visit https://groups.google.com/d/optout.