I have a form in my forms.py that looks like this:
from django import forms
class ItemList(forms.Form):
item_list = forms.ChoiceField()
I need to populate the item_list with some data from the database. When generated in HTML item_list should be something like:
<select title="ItemList">
<option value="1">Select Item 1</option>
<option value="2">Select Item 2</option>
</select>
The options values in my select statement will change almost every time since a variable in the query will often change generating new results.
What do I need to put in the view.py and also in my template files to populate the ItemList with values from the database?