Code

Opened 8 years ago

Closed 3 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.

Attachments (0)

Change History (4)

comment:1 Changed 7 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 3 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 3 years ago by lrekucki

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

comment:4 Changed 3 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.

Add Comment

Modify Ticket

Change Properties
<Author field>
Action
as closed
as The resolution will be set. Next status will be 'closed'
The resolution will be deleted. Next status will be 'new'
Author


E-mail address and user name can be saved in the Preferences.

 
Note: See TracTickets for help on using tickets.