Opened 18 years ago

Closed 18 years ago

#877 closed defect (duplicate)

ordering by primary key in admin with oneToOne relations is done over the wrong table

Reported by: anonymous Owned by: Adrian Holovaty
Component: contrib.admin Version: dev
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


If I use the admin application to browse for a relation that shares the primary key with another via an OneToOne fields, I take an error.
In my example, Person shares the primary key with Party, and browsing Person I take:

OperationalError at /admin/parties/persons/
(1109, "Unknown table 'parties_parties' in order clause")

It seems that the Sql related is

['parties_persons.party_id',..., 'parties_persons.last_modified']
' FROM parties_persons ORDER BY DESC'

and I can see that the order by is done on the "father" table.

Of course, if I force a different order field with ordering = -dob, for example, it's all o.k.

Change History (2)

comment:1 by bruce@…, 18 years ago

This is the same as ticket:930 I think, which has a patch attached.

comment:2 by jkocherhans, 18 years ago

Resolution: duplicate
Status: newclosed

Duplicate of #1245

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