Reputation: 31
I have a HTML template for the drop down list:
<select name="quality">
{% for quality in qs %}
{% ifequal qu.id sel.id %}
<option value="{{sele.key}}" selected="selected">Movie {{qu.id}}: {{quality.name}}</option>
{% else %}
<option value="{{sele.keyy}}">Movie {{qu.id}}: {{quality.name}}</option>
{% endifequal %}
{% endfor %}
</select>
How can i implement this in my models and views, or how can i write models and views for the drop down list ...
Upvotes: 0
Views: 2150
Reputation: 9441
Use django forms
They are great for reusing forms, validation, and make processing forms much more pythonic.
You can create a ChoiceField
in your form, and then give a tuple showing [[value, label], [value, label], [value, label]]
Upvotes: 1