Code

Opened 8 years ago

Closed 8 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
Component: contrib.admin Version: master
Severity: normal Keywords:
Cc: Triage Stage: Unreviewed
Has patch: no Needs documentation: no
Needs tests: no Patch needs improvement: no
Easy pickings: UI/UX:

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 (0)

Change History (2)

comment:1 Changed 8 years ago by bruce@…

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

comment:2 Changed 8 years ago by jkocherhans

  • Resolution set to duplicate
  • Status changed from new to closed

Duplicate of #1245

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.