django-el-pagination
django-el-pagination copied to clipboard
Duplicate entries problem
I used News.objects.all().order_by('-pub_timestamp').
pub_timestamp is a float number like 1522787700.0.
I found that the last entry in page 9 and the first entry are the same, also appeared on page 21 and page 22.
Is this a database sort problem?
witch method you use?
@shtalinberg
Use AjaxListView and return News.objects.all().order_by('-pub_timestamp') in get_queryset method.
Hi, I also have duplicate content issue.
store_admin/views.py
----------------------------
class StoreProductListView(AjaxListView):
template_name = 'store_admin/product_list.html'
page_template = 'store_admin/product_list_page.html'
context_object_name = 'products'
def get_queryset(self, **kwargs):
return Product.objects.all().order_by('id')
store_admin/product_list.html
---------------------------------------
{% paginate products %}
<table class="table table-striped table-bordered custom-table">
<thead>******* </thead>
<tbody class='endless_content_wrapper'>
{% include page_template %}
</tbody>
</table>
{% show_more %}
{% block js %}
{{ block.super }}
<script src="{% static 'dashboard/js/el-pagination.js' %}"></script>
<script>
$.endlessPaginate({
paginateOnScroll: true,
paginateOnScrollMargin: 20,
contentSelector: '.endless_content_wrapper'
});
</script>
{% endblock extra_js %}
store_admin/product_list_page.html
------------------------------------------------
{% for product in products %}
<tr>
<td> ******* </td>
***************
</tr>
{% endfor %}
Any Suggestions?
Thanks
Hello,
It seems to be a problem related to Django ORM.
return News.objects.all().order_by('-pub_timestamp', 'id')
try this.