ModelForms check constraints that they should not.
|Reported by:||jamiequint||Owned by:||nobody|
|Has patch:||yes||Needs documentation:||no|
|Needs tests:||no||Patch needs improvement:||no|
This is a patch for the changes committed in #8209
If you have a ModelForm with extra fields that represent foreign key relationships between models self.instance._meta.get_field_by_name(name) will find a field with the given name and will attempt to check it. However, this will fail because get_field_by_name will return a RelatedObject rather than a form field object like the code is expecting.
The submitted patch checks the value returned by get_field_by_name which returns true when the given field exists on the model, if this value is False it bypasses the check.
Change History (4)
Changed 7 years ago by jamiequint
comment:1 Changed 7 years ago by jacob
- milestone set to 1.1
- Needs documentation unset
- Needs tests unset
- Patch needs improvement unset
- Triage Stage changed from Unreviewed to Accepted