Ritu Singh
Problem:
I have this issue with pagination:
It works fine, but every time I click on it it adds one more ?page=1 at the end of the URL, so url looks like this after a few clicks:
example/something?query_params=5&page=1&page=1&page=1&page=1
I know why that happens, it's because I hardcoded it into URL, but I have to use get_full_path because I need other query parameters together with page.
So basically I want all those query params but WITHOUT page=something being added each time I change the page. I need only one page query parameter.
Solution:
You can effectively remove the page number in the view, like:
then in the view, we can work with:
We can also make a helper function for this to include the path:
and thus work with:
It is however a bit of a pity that the page object itself has no access to the request object, and that thus the pager could construct such links. I personally find this one of the shortcomings of Django's pagination system.
Suggested blogs:
>Laravel installation problem: Fix failed to download laravel/laravel from dist- Laravel (v10.2.6)
>How to fix when Postgres connection refused while running laravel tests on gitlab CI?
>Changing main page as Identity's Login page in ASP.NET Core 7
>How can I get the original type of a Mock after the Mock has been cast to an object
>Fix Cookie doesn't work error in .NET 6 Web API