﻿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
2210	[patch] order_by on related table with db_column different to name fails	Russell Cloran <russell@…>	Adrian Holovaty	"Hi,

When ordering by a related table which has a db_column different to the field name, and ordering by the field name, incorrect SQL is generated.

This bug is on line 483 of django/db/models/query.py (r3189) -- it incorrectly uses the opts of the main table, not the related table in the call to orderfield2column(). This shows up in the admin interface, when sorting by a related field.

I do not know the correct fix for this bug.

Russell"	defect	closed	Database layer (models, ORM)	dev	normal	duplicate	order_by related	bs1984@… russell@… gary.wilson@… real.human@… arthur.case@…	Accepted	0	0	0	0	0	0
