django-el-pagination icon indicating copy to clipboard operation
django-el-pagination copied to clipboard

Duplicate entries problem

Open Taosky opened this issue 7 years ago • 4 comments

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?

Taosky avatar Apr 04 '18 08:04 Taosky

witch method you use?

shtalinberg avatar Apr 10 '18 11:04 shtalinberg

@shtalinberg Use AjaxListView and return News.objects.all().order_by('-pub_timestamp') in get_queryset method.

Taosky avatar Apr 13 '18 03:04 Taosky

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

ajithpmohan avatar May 10 '18 17:05 ajithpmohan

Hello,

It seems to be a problem related to Django ORM.

return News.objects.all().order_by('-pub_timestamp', 'id')

try this.

onursa avatar Aug 14 '18 09:08 onursa