I have a question about the exclude property in ModelForm. When I
have a Model and the ModelForm for it excludes a field from that
Model, shouldn't the ModelForm validation excludes that field as well?
It seems the only way to exclude the field from validation is to make
it blank=True in the Model. However,
to me, the blank=True/False on Model seems to be in the wrong place.
The model is suppose to define the model, and blank defines the form
validation, so I don't believe it's in the right place and thus like
not to set it there and like to use exclude=('field1', etc.) instead
in the ModelForm level. But that doesn't seem to work and complain
that the excluded fields are required..
An example of this is a timestamp. The model defines a timestamp
field but the ModelForm for it should exclude the field since it needs
to be auto-generated. When the field is excluded from the ModelForm,
it should be excluded from the form validation as well, but it doesn't
and requires me to set blank=True in the Model instead, which again
seems wrong to me since the Model should have nothing to do with form
validation.
thoughts?
john
--~--~---------~--~----~------------~-------~--~----~
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
-~----------~----~----~----~------~----~------~--~---