def clean_username(self): cleaned_data = self.cleaned_data username = cleaned_data['username'] if user_exists(username=username): message = username_already_used_message(username) self._errors['username'] = ErrorList([message]) return username
def clean_email(self): cleaned_data = self.cleaned_data email = cleaned_data['email'] if user_exists(email=email): message = email_address_already_used_message(email) self._errors['email'] = ErrorList([message]) return email