user12345
user12345

Reputation: 2418

going to next page using django paginator sends request again.

My google search application making a request each time while i am using paginator. Suppose i have a 100 records. Each page have to show 10 records so ten pages. When i click 2nd page it again sending a request. Ideally it should not send the request.

Upvotes: 0

Views: 93

Answers (1)

Manoj Govindan
Manoj Govindan

Reputation: 74705

When i click 2nd page it again sending a request. Ideally it should not send the request.

What do you mean by request? Is it a request to Google?

Your application apparently does not cache the results. If your request to Google returns 100 pages then you should cache those hundred. When you request the second page the view should retrieve this cache and return the second page to you.

If you mean request to your app, then @Daniel's comment has it right. You can get around this by sending all the results to the browser and then do the pagination using JavaScript to avoid this.

A more detailed answer is difficult without seeing some code.

Upvotes: 1

Related Questions