开发者

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.

0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜