0

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 ...

1
  • 2
    You need a forms.ChoiceField or a forms.ModelCoiceField. What are you doing with the form and where does the "quality" variable comes from? Commented Nov 8, 2012 at 11:07

1 Answer 1

1

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]]

Sign up to request clarification or add additional context in comments.

Comments

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.