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

Description

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: Admin.ordering isn't working for inlined ForeignKey relationshipsAdmin.ordering isn't working for edit_inline ForeignKey fields
Triage Stage: UnreviewedAccepted

comment:2 Changed 6 years ago by Ramiro Morales

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 6 years ago by Łukasz Rekucki

Severity: normalNormal
Type: defectBug

comment:4 Changed 5 years ago by Julien Phalip

Easy pickings: unset
Resolution: fixed
Status: newclosed
UI/UX: unset

Closing as fixed as per Ramiro's comment.

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