Tuesday, July 3, 2012

Tutorial three '-pub_date'

Hey Djangoers,

I am on the tutorial 3, and found this code where we are modifying the view index()

    def index(request):      latest_poll_list = Poll.objects.all().order_by('-pub_date')[:5]      output = ', '.join([p.question for p in latest_poll_list])      return HttpResponse(output)  
What I did not understand, was why did we state,

order_by('-pub_date'), what does that '-' mean before 'pub_date' ? 

--
Thanks & Regards
Smaran Harihar

--
You received this message because you are subscribed to the Google Groups "Django users" group.
To post to this group, send email to django-users@googlegroups.com.
To unsubscribe from this group, send email to django-users+unsubscribe@googlegroups.com.
For more options, visit this group at http://groups.google.com/group/django-users?hl=en.

No comments:

Post a Comment