2👍
✅
The answer is that you don’t need to override the clean method here because
The ModelForm.clean() method sets a flag that makes the model
validation step validate the uniqueness of model fields that are
marked as unique, unique_together or unique_for_date|month|year.If you would like to override the clean() method and maintain this
validation, you must call the parent class’s clean() method.
So all your need is
forms.py
class userForm(forms.ModelForm):
class Meta:
model = user
fields = ["name"]
that’s it!
👤e4c5
Source:stackexchange.com