It doesn't answer the question, but why don't you want to render the field
automatically?

On Tue, Jun 9, 2015 at 6:47 PM, <[email protected]> wrote:

> Hi,
>
> I have the same problem of this guy (
> http://stackoverflow.com/questions/21884631/keeping-option-selected-after-form-is-submitted-in-django),
> but I do not want to render a field like Daniel Roseman
> <http://stackoverflow.com/users/104349/daniel-roseman> said in the answer.
>
> Here is the code:
>
> <select id="{{ form.activity.auto_id }}" name="{{ form.activity.name }}"  
> data-size="10">
>     {% for id, name in form.activity.field.choices %}
>         {% if form.activity.value == id %}
>             <option value="{{ id }}" selected>{{ name }}</option>
>         {% else %}
>             <option value="{{ id }}">{{ name }}</option>
>         {% endif %}
>     {% endfor %}
> </select>
>
>
> Thanks in advance.
>
>  --
> You received this message because you are subscribed to the Google Groups
> "Django users" group.
> To unsubscribe from this group and stop receiving emails from it, send an
> email to [email protected].
> To post to this group, send email to [email protected].
> Visit this group at http://groups.google.com/group/django-users.
> To view this discussion on the web visit
> https://groups.google.com/d/msgid/django-users/a6a2db7a-e4b0-4281-b6db-6f31009ac68d%40googlegroups.com
> <https://groups.google.com/d/msgid/django-users/a6a2db7a-e4b0-4281-b6db-6f31009ac68d%40googlegroups.com?utm_medium=email&utm_source=footer>
> .
> For more options, visit https://groups.google.com/d/optout.
>

-- 
You received this message because you are subscribed to the Google Groups 
"Django users" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to [email protected].
To post to this group, send email to [email protected].
Visit this group at http://groups.google.com/group/django-users.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/django-users/CALn3ei0cQOhZA1ae%3DVozqdL3uxERTpfinYRBx1CncGiu3Tepmw%40mail.gmail.com.
For more options, visit https://groups.google.com/d/optout.

Reply via email to