Django forms which fields are required as "bound" fields to validate
Per this question: Difference between Django Form 'initial' and 'bound
data'? :
Here's the key part from the django docs on bound and unbound forms.
If it's bound to a set of data, it's capable of validating that data and
rendering the form as HTML with the data displayed in the HTML.
If it's unbound, it cannot do validation (because there's no data to
validate!), but it can still render the blank form as HTML.
My question is: Is there an easy way to know which fields need to be bound
in order to validate?
We have a multi-inheritance ModelForm nightmare and it's really tough to
figure out which what are the minimum required fields to "bind".
In this case I've tried matching my form.data to vars(form.fields), but
this is not enough, it's just ongoing potluck tracking back through the
models and adding more and more to the form.data in an ad-hoc way.
Is there some cardinal list somewhere of the minimum requirements of
bindable fields?
No comments:
Post a Comment