I have looked into the solution and found several ways to do this, however 
considering this may be tedious, would like some pointers to do this in the 
most clever way.

I am creating a form composed of several sections, where one of the section 
depends on the selection of one of the widget. More precisely my first 
widget is a ChoiceField of text items, rendered as a drop-down list in 
HTML. Depending on the selection of this first widget, there should be a 
second widget below it, but the nature of that widget may vary, e.g.:

   - 
   
   if the first widget has choice 0, 2 or 3 selected then the second widget 
   should be another ChoiceField of text items.
   - 
   
   if the first widget has the choice 1 or 4 selected, then the second 
   widget should be a BooleanField rendered as a series of checkboxes with 
   different values, where one or more can be selected. The choices for both 
   widgets are not changed at runtime, but they could be extended in the 
   future. - 
   
Ideally, I should use javascript so that the second wiget is rendered upon 
selection of the first, prior to submitting the request.

I have started to implement this using forms, but as you can imagine there 
is a lot of logic behind this, having to branch the rendering of the second 
widget depending on the first. I am wondering if there is a "best" way to 
do this? I looked already into chained selects (such as provided by 
django-smart-selects), but am wondering if this is an overkill. Also, 
should I use a model to describe the widget relationship, and use a 
ModelForm instead?

Many thanks in advance for your advice.

-- 
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 django-users+unsubscr...@googlegroups.com.
To post to this group, send email to django-users@googlegroups.com.
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/4a2e0aea-79eb-4048-a053-306fdb8b1bfe%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.

Reply via email to