Add validate_unique flag to ModelForm.Meta
|Reported by:||wogan||Owned by:||wogan|
|Has patch:||yes||Needs documentation:||yes|
|Needs tests:||yes||Patch needs improvement:||yes|
ModelForm's currently have a wart in that if you override clean()
you have to call super() to ensure that unique constraints are validated.
This can lead to surprises if you haven't read the documentation closely.
It seems to me this would be better as a property on the Meta class.
class DontCheckForm(ModelForm): def clean(self): return self.cleaned_data class Meta: model = SomeModel
class DontCheckForm(ModelForm): class Meta: model = SomeModel validate_unique = False