[Answer]-Django Paging With Same GET

1👍

I’m guessing you’re using the <href> example in the docs you linked to in your template? i.e.:

<a href="?page={{ listing_info.next_page_number }}">next</a>

The problem with that is that it will only return your current url plus the query parameters you’ve provided, which is only the ?page parameter.

I think you can fix this with two different things. First, you need to get your Make parameter in your view and pass it to your template. Try adding something like:

make = request.GET.get('Make', None)
...
return render_to_response('list.html', {"listing_info": listing_info, "make": make})

Then, you’ll need to adjust your href tag in your template so it also passes the make:

<a href="?Make={{ make }}?page={{ listing_info.next_page_number }}">next</a>

You may need to play with that a little and also deal with how to handle if it Make = None (if possible).

👤Alex

Leave a comment