Hi Shawn,

I spent some time playing with dir and reading the django code for
forms, but to me there is no evident way to iterate through the single
choices within a choicefiled.


Hope I'm wrong and I missed something.



On Jan 21, 9:25 am, Shawn Milochik <sh...@milochik.com> wrote:
> If this kind of thing isn't clear from the documentation at 
> docs.djangoproject.com, I recommend throwing some print/debug statements into 
> your views to explore the objects. Take advantage of Python's introspection.
>
> For example, before you return the response in your view, try some of these 
> things:
>
> print dir(the_form.my_choicefield)
> print dir(the_form.fields['my_choicefield']
> print dir(the_form)
>
> See what they give you, and go from there. You will probably notice things in 
> the output of one or more of those lines that will give you something else to
> print a dir() or help() on. You might even find undocumented features. Use 
> what you learn from that to fix your problem, or so that you'll have something
> specific to type in on the docs.djangoproject.com search form.
>
> Using Python's introspection is often a great way to answer your own 
> questions and discover new features.
>
> Shawn
-- 
You received this message because you are subscribed to the Google Groups 
"Django users" group.
To post to this group, send email to django-us...@googlegroups.com.
To unsubscribe from this group, send email to 
django-users+unsubscr...@googlegroups.com.
For more options, visit this group at 
http://groups.google.com/group/django-users?hl=en.


Reply via email to