mardi 15 mars 2022

How to select multiple posts through django checkboxes for comparison on a seperate page but pagination not allowing it

I'm a beginner in Django. Thanks for your help and patience.

I have a model which I use to show a list of posts. I am using django pagination as there are many posts. I want the visitor to be able to select some posts through checkboxes. The selected posts are then used for comparison on a seperate page.

In the html template, I have all the posts inside a form - each post is associated with a checkbox (checkbox is not part of the model). When a visitor selects some posts and clicks a submit button, then a view function returns a page with the selected posts for comparison. It all works fine, but the problem is with the pagination - i.e., when the visitor selects posts from different pages. For example, when selecting posts from the second page, those that were selected in the first page are not considered (no longer checked ?).

I have looked at using sessions, form wizard, etc. But I still can't figure out how they can help or what is the appropriate approach for me to investigate more.

Any guidance would be appreciated.




Aucun commentaire:

Enregistrer un commentaire