I am a Django newbie and am stuck on a small problem.
I am trying to build a view where the user enters a from and to date and I need to pull records from my database according to these dates. I have worked out how to pull records without the user input dates(I tested using system dates, used deltas according to the documentation listed on the official website and i understood it) however am stuck now on how to get them as a user input.
Here are a few relevant details of my project:
models.py contains a lot of fields but here is the date field entry:
date = models.DateField(auto_now_add=True)
This entry defines the date the record is created.
forms.py:
I am using an unbound form(not linked to the model created in models.py) and am using the Jquery plugin listed here in a simple HTML page to show the from and to date.
As a result the dates are passed as plain text in the form according to the documentation listed.
The only way I know on how to get a user input is through a form(bound or unbound) which usually ends up as a POST request passing data into the db either through insert record or update record. I do not know of and could not find any other way of getting a user input where it does not need to passed to the db.
Can someone kindly advise how to get the user input dates using this plugin and :
How to extract the from and to dates from the user input from the POST request in the views.py view?
How to convert it to a
DateField
(or if the form taking these dates should have the dates set as aDatefield
)?
Thanks in advance..