I want to combine pagination with filtering. Since I have a lot of filters, I don’t want to send them on a GET request, as the URLs become very ugly.
Since django pagination uses a GET request to pass page parameters, I don’t know how I can combine these two approaches.
Any idea?
A great addition would be: How can I combine this approach with table sorting ?:-)
Edit:
In fact, it should work like pagination stackoverflow - user questions. If the user clicks on the page number, the correct page is displayed without showing the retrieval options in the URL.
This is the url. https://stackoverflow.com/api/userquestions.html?page=2&pagesize=10&userId=237690&sort=Recent
But the URL displayed in the browser is neat and short. It seems to be ajax. Does anyone know how to implement this? :)
If the URL does not appear in the address bar of the browser, I don't care if it is beautiful or not.
Edit: Solution:
Make an ajax update with all the filter options passed to the view. This should help you get started with implementing ajax for your site: link
Thus, GET parameters are never displayed in the address bar.
django
Thomas kremmel
source share