Joe Linoff
unread,Jun 25, 2011, 6:39:24 PM6/25/11Sign in to reply to author
Sign in to forward
You do not have permission to delete messages in this group
Either email addresses are anonymous for this group or you need the view member email addresses permission to view the original message
to django...@googlegroups.com
Hi Folks:
I am a newbie who is really enjoying Django. It is a great system and has really saved me a lot of time but I am having a problem trying to control the column order in a queryset.
In SQL my queries would look something like this:
-- column order #1
SELECT 'Third','Second',First' FROM test ORDER BY 'Third' ASC;
-- column order #2
SELECT 'First','Third','Second' FROM test ORDER BY 'First' ASC;
In Django 1.3 I am doing this:
# column order #1
data = test.objects.values('Third','Second','First').order_by('Third').all()
data = test.objects.values('Third','Second','First') # tried this as well
# column order #2
data = test.objects.values('First','Third','Second').order_by('First').all()
data = test.objects.values('First','Third','Second') # tried this as well
Unfortunately, the columns are always returned in the same order.
What am I doing wrong? I am trying to do something that isn't supported?
Regards,
Joe