Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Django passing querysets between pages

I have a view which does a pretty heavy query on three separate databases and outputs the count of each query into a template. From the the user can go to one of the three results and get the detailed results. I don't want to repeat myself in my views and I want to maximize performance, so my question is what is the best way to achieve this result?

Can I pass a queryset to another page (get or post)? Should I save the queryset in a session (I am not currently using session for this project as it is fully public) Or is there a better way?

I know this is not a highly specific question, but I would appreciate any advice on this (I'm guessing - not uncommon) situation.

like image 580
Darwin Tech Avatar asked Mar 26 '26 03:03

Darwin Tech


1 Answers

From my experience, I think saving your result on session is a good and simple solution.

like image 76
juliomalegria Avatar answered Mar 27 '26 21:03

juliomalegria