Hallo there. i have problem with my order_by when using paginator. the data 
are not sort well. data becomes random. 

when i do 
 qs = Messages.objects.filter(
                main_msg=get_message).order_by('datetime')

the data are sort well by order_by. 
but when i'm using paginator = Paginator(qs, 7) . 

the data are become random. paginator didnt show my lasts data "order_by". 
but paginator show it random.

here is my complete code.

            qs = Messages.objects.filter(
                main_msg=get_message).order_by('datetime')

            paginator = Paginator(qs, 7)
            if request.method == 'GET':
                if request.is_ajax():
                    if request.GET.get('page_number'):
                        page_number = request.GET.get('page_number')
                        try:
                            page_objects = paginator.page(
                                page_number).object_list
                        except InvalidPage:
                            return HttpResponse("")
                        return 
render_to_response('user_app/ajaxresponse/load_more_messages.html', 
locals(), context_instance=RequestContext(request))

            objects = paginator.page(1).object_list
            print objects
            context = dict(
                object_list=objects,
            )

any solution for this problem ?

thanks

-- 
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 django-users+unsubscr...@googlegroups.com.
To post to this group, send email to django-users@googlegroups.com.
Visit this group at https://groups.google.com/group/django-users.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/django-users/cb4d6f7f-9e5a-40e2-bffe-fa97559f8fb8%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.

Reply via email to