Opened 10 years ago

Closed 5 years ago

#2679 closed Bug (fixed)

Admin.ordering isn't working for edit_inline ForeignKey fields

Reported by: treborhudson@… Owned by: nobody
Component: contrib.admin Version:
Severity: Normal Keywords:
Cc: Triage Stage: Accepted
Has patch: no Needs documentation: no
Needs tests: no Patch needs improvement: no
Easy pickings: no UI/UX: no


Note: I've only tested this with "backward" foreign keys. This does work with Meta.ordering but I don't want this ordering to happen on queries outside of the admin so I moved the ordering property to the "class Admin" and the ordering isn't working. I've verified that the SQL queries are not adding the "ORDER BY" clause by adding this to the admin base.html template:

<!-- SQL Queries -->
{% for s in sql_queries %}
SQL: {{ s.sql }}
TIME: {{ s.time }}
{% endfor %}

If a test case is needed I could provide a simple model for this.

Change History (4)

comment:1 Changed 10 years ago by Gary Wilson <gary.wilson@…>

  • Summary changed from Admin.ordering isn't working for inlined ForeignKey relationships to Admin.ordering isn't working for edit_inline ForeignKey fields
  • Triage Stage changed from Unreviewed to Accepted

comment:2 Changed 6 years ago by ramiro

Ability to respect its own ordering option was added to InlineModelAdmin (and children) in r14882 so I'm closing this ticket as fixed although it reported the issue against to the equivalent inline implementation available at that time (inner Admin class).

comment:3 Changed 5 years ago by lrekucki

  • Severity changed from normal to Normal
  • Type changed from defect to Bug

comment:4 Changed 5 years ago by julien

  • Easy pickings unset
  • Resolution set to fixed
  • Status changed from new to closed
  • UI/UX unset

Closing as fixed as per Ramiro's comment.

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