Hi Karen, Thanks for your point (it explains why I couldn't see anything about that in "current" django documentation.). So I need to wait for 1.1 or to make something different... Thanks for your reply Karen,
Regards, Pierre On Mar 23, 2:52 pm, Karen Tracey <[email protected]> wrote: > On Mon, Mar 23, 2009 at 6:46 AM, Pierre <[email protected]> wrote: > > > Hi, > > > I turning crazy with something which seems relatively easy but isn't > > (for me). > > I want to create a dropdown (aka <select><option><option></select>) in > > a form. To do this, I use a forms.ChoiceField > > (label="Categories",required=True, choices=catz) > > > I'd like to have some choices in this drop down to be "disabled" to > > create a kind of classification in this drop down. > > -- Root -- Disabled > > --child one -- not disabled > > --Root 2 -- Disabled > > --childtwo -- not disabled > > > etc. > > > Is there any way to do this easily ? I think choiceField doesn't allow > > to pass extra attributes isn't it ? > > If what you want to do is organize the choices into nested groups, then that > is supported in 1.1 alpha and trunk. See the doc here: > > http://docs.djangoproject.com/en/dev/ref/models/fields/#choices > > and scroll down to where MEDIA_CHOICES are split into Audio, Video, and > unknown. The implementation of this is to group the choices together using > html optgroup, not to disable the "root" choices, but it seems to be what > you are looking for. > > Karen --~--~---------~--~----~------------~-------~--~----~ You received this message because you are subscribed to the Google Groups "Django users" group. To post to this group, send email to [email protected] To unsubscribe from this group, send email to [email protected] For more options, visit this group at http://groups.google.com/group/django-users?hl=en -~----------~----~----~----~------~----~------~--~---

