﻿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
6428	database api order_by() doesn't work with dynamic column names if order by descending	anonymous	nobody	"When the order by column name is passed in as a variable, the API doesn't parse the sorting column name, but take it as a whole, including the ""-"" sign.
e.g.
sortColumn = ""-"" + request.GET['sortColumn']
print sortColumn #e.g. sortColumn='-type'
myObj = DBObj.objects.all().order_by(sortColumn)

The following SQL is generated, and create an exception
SELECT ... FROM ... ORDER_BY ""mytable"".""-type""
 "		closed	Database layer (models, ORM)	0.96		invalid	order_by		Unreviewed	0	0	0	0	0	0
