tags:

views:

74

answers:

0

i'm using Django 0.96 and want to implement the following form: the user must either choose value from dropdown list or enter its own string to textbox field. the required field should be indicated by checkbox (if it's on - the required field is a charfield, otherwise - dropdownlist)

 DB        : __DBvalues___V # dropdownlist
 own choice: X              # checkbox
 user imput: ______________ # charfield


   class   LabelList(models.Model):
      LabelListAttr= models.ForeignKey(Label)


   class UserInputForm(forms.Form):
        user_label          = forms.CharField(max_length=20,required=False)
        user_label.label    = "New label"
        is_user_label       = forms.BooleanField()
        is_user_label.label = "Create new label?"

    DBListForm = form_for_model(LabelList)

    class LabelChoiceForm(UserInputForm,DBListForm ):
     ""

is there any way to implement that?