Django

Code

Ticket #877 (closed: duplicate)

Opened 3 years ago

Last modified 3 years ago

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

Reported by: anonymous Assigned to: adrian
Milestone: Component: django.contrib.admin
Version: SVN Keywords:
Cc: Triage Stage: Unreviewed
Has patch: 0 Needs documentation: 0
Needs tests: 0 Patch needs improvement: 0

Description

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

select ['parties_persons.party_id',..., 'parties_persons.last_modified'] sql ' FROM parties_persons ORDER BY parties_parties.id 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.

Attachments

Change History

12/14/05 20:03:35 changed by bruce@cubik.org

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

04/21/06 10:46:07 changed by jkocherhans

  • status changed from new to closed.
  • resolution set to duplicate.

Duplicate of #1245


Add/Change #877 (ordering by primary key in admin with oneToOne relations is done over the wrong table)




Change Properties
Action