[Answered ]-How to store large fetched dataset from postgres in Django view?

1👍

The easier approach is to do this with two pages:

  • First page: User can choose to load the data
  • Second page: Loads the data and shows it

If you want to do this on the same page you normally put a div on your page where the data should be loaded and then you need to use Javascript / AJAX to load and update your current page (or a part of it) based on user input like a clicked button.

There are multiple ways to implement this. Here are some examples:

I would recommend HTMX, because it allows you to do this without having to write any JavaScript and it works great together with Django templates.

Leave a comment