id,summary,reporter,owner,description,type,status,component,version,severity,resolution,keywords,cc,stage,has_patch,needs_docs,needs_tests,needs_better_patch,easy,ui_ux 877,ordering by primary key in admin with oneToOne relations is done over the wrong table,anonymous,Adrian Holovaty,"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. ",defect,closed,contrib.admin,dev,normal,duplicate,,,Unreviewed,0,0,0,0,0,0