instead of
     q_list = ObjectPaginator(Queue.objects.all(), 20)
Provide a order_by, if you would like them to be in descending order,
in order when they were created have,
     q_list = ObjectPaginator(Queue.objects.all().order_by('-id'),
20)
Or better yet have a created_on field in the model, with auto_now_add
as 1, and order on that field as
     q_list = ObjectPaginator(Queue.objects.all().order_by('-
created_on'), 20)

On Jan 11, 6:12 pm, Nader <[EMAIL PROTECTED]> wrote:
> Hello,
>
> I use a view in an application with which I can present the 20 pages
> of a table at once.
>
> from queues.models import Queue
>
> def list(request, page=0, message=" "):
>     page = int(page)
>     q_list = ObjectPaginator(Queue.objects.all(), 20)
>     has_previous = q_list.has_previous_page(page)
>     has_next = q_list.has_next_page(page)
>     return render_to_response(
>         'queues/list.html', {'q_list': q_list.get_page(page),
>         'has_previous': has_previous,
>         'previous_page' : page -1,
>         'has_next': has_next,
>         'next_page': page + 1,
>         'message': message,}
>         )
>
> It present the first 20 records of table, but I would like to present
> the last 20 records from the table (from the bottom of table). Would
> somebody tell me how I can solve this?
>
> Regards,
> Nader
--~--~---------~--~----~------------~-------~--~----~
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 [EMAIL PROTECTED]
For more options, visit this group at 
http://groups.google.com/group/django-users?hl=en
-~----------~----~----~----~------~----~------~--~---

Reply via email to