'-' reverses the ordering of that field. So it will order the most recently
published Polls first.

On Tue, Jul 3, 2012 at 2:33 PM, Smaran Harihar <[email protected]>wrote:

> Hey Djangoers,
>
> I am on the tutorial 
> 3<https://docs.djangoproject.com/en/dev/intro/tutorial03/#write-views-that-actually-do-something>,
> 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 [email protected].
> To unsubscribe from this group, send email to
> [email protected].
> For more options, visit this group at
> http://groups.google.com/group/django-users?hl=en.
>

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

Reply via email to