Losing order of sorted queryset With Django-Endless-Pagination -


i've got few sorted querysets im passing template. multiple paginations shown per page. problem after first series of paginated items, subsequent ones lose sort. here's code:

views.py

    def entry_index(request, parent_cat, child_cat, template='entry_index.html',                       page_template='entry_index_page.html'):                   context = { 'items_by_percentage_saved':                        item.objects.filter(category=category).order_by('-percentage_saved'),  }                 if request.is_ajax():                     template = page_template                     return render_to_response(template, context,                                                 context_instance=requestcontext(request)) 

by_percentage_saved.html

{% load endless %} {% paginate items_by_percentage_saved %} {% item in items_by_percentage_saved %} <div class="large-4 small-6 columns">   <a class="th" href=""><img style="height: 12em;" src={{ item.image_url }}></a>    <div class="panel">     <h5>{{ item.title|truncatechars:50 }}</h5>     ...   </div> </div> {% endfor %} {% show_more %} 

update i've done more debugging , items_by_percentage_saved queryset sorted in entry_index(). put few breakpoints in by_percentage_saved.html see if figure out whats going on, strangely after click "more" next paginated data, entry_index() called again breakpoints never fire second time in by_percentage_saved.html, though new paginated data generated. talk confusing

ok have solved going through docs again , using page decorators. docs kinda make sound these optional guess requirement multiple pagination on same page.

from endless_pagination.decorators import page_template @page_template('entry_index_page.html')
@page_template('by_percentage_saved.html', key='by_percentage_saved')
def entry_index(request, parent_cat, child_cat, template='entry_index.html',
extra_context=none):


Comments

Popular posts from this blog

Unable to remove the www from url on https using .htaccess -