Inside my django project i have a template called formquestions.html. Inside the template I am looping through all sub categories from my database (right now it is only 1 for testing purposes). My issue is that my ChoiceField
is not dropping down so you may select other options. If I move outside of the for loop it works just fine.
# form.py
DATA_DISPLAY_TYPE = (
('input', 'Input'),
('select', 'Select'),
('checkbox', 'CheckBox'),
)
class EditSubInfo(forms.Form):
help_text = forms.CharField(widget=forms.Textarea)
data_display_type = forms.ChoiceField(choices=DATA_DISPLAY_TYPE)
# formquestions.html
{% for sub in subs %}
Name: sub.name
Choices: {{form.data_display_type}}
{% endfor %}
The ChoiceField
renders just fine. But when you try to click on it, nothing happens. If I move it outside of the for loop, it will work just fine. Any ideas of what is going wrong?