Post html input date to sql query as parameter with Django using pyodbc and refresh page

I have this project at work which consists in building a dashboard of quantities of interest to help with decision making.

The information I need to achieve this is stored in a read-only mssql database from a third party software.

I can access the information I need using pyodbc and writing raw sql queries and store the results in pandas DataFrames using pandas.read_sql_query(my_raw_query_as_string, connection). This solution comes in handy as sometimes I rework the query results to calculate indicator values.

My team and I decided to display this dashboard on an internal website to increase the visibility of the indicators.

We chose to use the Django Framework as, because it runs with python, we can still use our data processing routines previously written using pyodbc and pandas.

Building the dashboard, I realised I could ( and don't know if I should) completly forget about the Django ORM and still manage to display charts (using pychart.js) of the indicators.

I would like the user to input html Dates on the dashboard interface, pass these dates to my queries as parameters, gather another result which I process and refresh the graphs.

I tried to do it with htlm forms but I can't root the submitted data to python, plus when I submit the dates, the url changes which I do not want. I whish to stay on the dashboard page.

Has anyone managed to do something like that with Django?

Have a great day!


Back to Top