﻿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
13490	Django's `order_by` Performs Differently Based on Environment	b14ck	nobody	"Hi there. I came across the following (seemingly) inconsistency with Django's `order_by` method, that is usually used on DB queries. It appears to act differently when used in production vs. when used through python manage.py shell:

# from python manage.py shell
{{{
rdegges@WEB01:~/partyline_portal$ python manage.py shell
Python 2.6.4 (r264:75706, Dec  7 2009, 18:43:55) 
[GCC 4.4.1] on linux2
Type ""help"", ""copyright"", ""credits"" or ""license"" for more information.
(InteractiveConsole)
>>> from partyline_portal.partylines.models import Partyline
>>> partylines = Partyline.objects.all()
>>> partylines
[<Partyline: Randall Test>]
>>> partylines = Partyline.objects.all().order_by('name')
>>> partylines
[<Partyline: Randall Test>]
>>> partylines = Partyline.objects.all()
>>> partylines
[<Partyline: Randall Test>]
>>> partylines.order_by('name')
[<Partyline: Randall Test>]
>>>
}}}

As you can see above, I can use the `order_by` function on both queries: Partyline.objects.all().order_by('name') as well as lists: partylines.order_by('name')

However, if I run this same code in a view, and render a page to the user, Django spits an error saying that partylines has no method `order_by` available to it.

"		closed	Uncategorized	dev		invalid	database, query, order_by, inconsistency	rdegges@…	Unreviewed	0	0	0	0	0	0
