def clean_username(self): username = self.cleaned_data['username'] if services.retrieve_user(username): raise validators.ValidationError( u'Ese usuario ya existe, por favor introduce otro nombre.', ) return username
def clean_username(self): username = self.cleaned_data['username'] if username != self.initial['username']: if services.retrieve_user(username): raise validators.ValidationError( u'Ese usuario ya existe, por favor introduce otro nombre.', ) return username
def clean(self): cleaned_data = super(ForgotPasswordForm, self).clean() username = self.cleaned_data['username'] user = services.retrieve_user(username) if not user: self._errors['username'] = self.error_class([u'Ese nombre de usuario no existe.']) del cleaned_data['username'] else: cleaned_data['user'] = user return cleaned_data
def clean(self): cleaned_data = super(ForgotPasswordForm, self).clean() username = self.cleaned_data['username'] user = services.retrieve_user(username) if not user: self._errors['username'] = self.error_class( [u'Ese nombre de usuario no existe.']) del cleaned_data['username'] else: cleaned_data['user'] = user return cleaned_data