Save django queries for reuse

40 views
Skip to first unread message

lovesh harchandani

unread,
May 31, 2014, 5:41:53 PM5/31/14
to django...@googlegroups.com
In my application a user can generate reports on multiple models using multiple criteria. I want to let the user save the queries(with the criteria). What is a good approach?

Derek

unread,
Jun 1, 2014, 10:08:42 AM6/1/14
to django...@googlegroups.com
You have not given enough details on your reporting setup; so my guess would be to save the details into a new table.  This would include data such as:

* id (for the record)
* user_id
* report_id
* date_time
* parameters

The "parameters" are  a text field; with the criteria/parameters which created the report saved as a JSON object.  That way if the report gets extended you can still retrieve at least some of the criteria from the JSON data.

You might also want to allow the allow the user to give their own Title/Name to the report so they can more easily find it again (assuming you give them a list to choose from); and perhaps the option to make it private/public, depending on your setup.

But one thing you do not want to do is save the actual data from the report!!

HTH.
Reply all
Reply to author
Forward
0 new messages