Thanks for succinctly educating me on this matter. I thought it was a quirk but now I know.
On Tuesday, June 18, 2013 5:11:07 AM UTC-7, Jani Tiainen wrote: > > On Mon, 17 Jun 2013 21:34:00 -0700 (PDT) > Dandall Von <[email protected] <javascript:>> wrote: > > > I have successfully setup Django with postgreSQL and everything is fine > > except for a minor problem. > > > > One the very last section of the the tutorial part 1 where we type > > p.pchoice_set.all(), it displays the > > choices in the reverse order. > > > > For example I get: Just hacking again, The sky, Not much > > Instead of: Not much, The sky, Just hacking again > > > > I typed it in the order it shows and still I get a reverse order. > > > > Any ideas? > > That is how databases do work. > > Default ordering is "no ordering". So you get results in no particular > order. > > To have consistent fixed ordering you need to tell it somehow to database > backend, in Django it's done by .order_by() [1] > > And then you have to select field you sort by. In case of tutorial there > is not actually any good field to sort by in Choice-model. > > > [1] https://docs.djangoproject.com/en/1.5/ref/models/querysets/#order-by > -- > > Jani Tiainen > > "Impossible just takes a little longer" > > -- You received this message because you are subscribed to the Google Groups "Django users" group. To unsubscribe from this group and stop receiving emails from it, send an email to [email protected]. To post to this group, send email to [email protected]. Visit this group at http://groups.google.com/group/django-users. For more options, visit https://groups.google.com/groups/opt_out.

