Monday, July 2, 2012

Re: Newbie form question

hi

the approach is correct, i think the problem is with the Field name
have you used 
choices = ....... ?

if yes cloud you change the name of this field?

cheers,

2012/7/2 Russ Abbott <russ.abbott@gmail.com>
As a Django newbie I apologize if this is a trivial question.

I'd like to use a form field as an element in a generated page but not as part of a form.  In particular, I'm generating a table, some of whose elements are text and others of which I want to be drop-down lists. I thought I might be able to use forms.ChoiceField to generate the drop-down lists.

When I write

...
choices = forms.ChoiceField([1, 2, 3]) # as a test case
...

I get a django.forms.fields.ChoiceField object. But when I include it as an element of the table nothing appears.  

Is this a reasonable approach? (It seems very easy if it really could be made to work.) If so, what should I do to get it to display as a drop-down list?

Thanks.

--
You received this message because you are subscribed to the Google Groups "Django users" group.
To view this discussion on the web visit https://groups.google.com/d/msg/django-users/-/U1l9_rTtkmQJ.
To post to this group, send email to django-users@googlegroups.com.
To unsubscribe from this group, send email to django-users+unsubscribe@googlegroups.com.
For more options, visit this group at http://groups.google.com/group/django-users?hl=en.

--
You received this message because you are subscribed to the Google Groups "Django users" group.
To post to this group, send email to django-users@googlegroups.com.
To unsubscribe from this group, send email to django-users+unsubscribe@googlegroups.com.
For more options, visit this group at http://groups.google.com/group/django-users?hl=en.

No comments:

Post a Comment