Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Duplicate entries problem #115

Open
Taosky opened this issue Apr 4, 2018 · 4 comments
Open

Duplicate entries problem #115

Taosky opened this issue Apr 4, 2018 · 4 comments

Comments

@Taosky
Copy link

Taosky commented Apr 4, 2018

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?

@shtalinberg
Copy link
Owner

witch method you use?

@Taosky
Copy link
Author

Taosky commented Apr 13, 2018

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

@ajithpmohan
Copy link

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

@onursa
Copy link

onursa commented Aug 14, 2018

Hello,

It seems to be a problem related to Django ORM.

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

try this.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

4 participants