python - Django form field required based on field from another form -


i have form in set form fields 'required' based on value form in same view

example

class forma(forms.form):     field_a = forms.charfield()     field_b = forms.charfield()  class formb(forms.form):     field_x = forms.choicefield(choices = [('a', 'a'), ('b', 'b')]) 

i set fields in forma required during validation of form, based on value of fields_x in formb. there clean way in django ?


Comments

Popular posts from this blog

angular - Ionic slides - dynamically add slides before and after -

minify - Minimizing css files -

Add a dynamic header in angular 2 http provider -