Problem understanding a django form
class UserField(forms.EmailField):
def clean(self, value):
super(UserField, self).clean(value)
try:
User.objects.get(username=value)
raise forms.ValidationError("There is an exist开发者_运维问答ing account associated with this email.")
except User.DoesNotExist:
return value
the try except method is straightforward. However, I am having a hard time figuring out the
super(UserField, self).clean(value)
super(UserField, self).clean(value)
is calling the ancestor method : forms.EmailField.clean(value)
to check that the email is well formed.
精彩评论