def clean_username(self): username = self.cleaned_data.get('username') if datasender_count_with(username) > 0: raise ValidationError( _("This email address is already in use. Please supply a different email address" )) return self.cleaned_data.get('username').lower()
def _check_uniqueness_of_email_addresses(reporter_details): errors = [] success = True for existent_email_address in reporter_details.values(): count = datasender_count_with(existent_email_address) if count > 0: success = False errors.append("User with email %s already exists" % existent_email_address) return success, errors
def clean_email(self): """ Validate that the supplied email address is unique for the site. """ email = self.cleaned_data.get('email') if not email: return email if datasender_count_with(email) > 0: raise forms.ValidationError( _("This email address is already in use. Please supply a different email address.")) return self.cleaned_data['email']
def _validate_duplicate_email_address(self, email): # registered_emails = self._get_registered_emails() matching_email_count = datasender_count_with(email) if matching_email_count > 0: raise DataObjectAlreadyExists(_("User"), _("email address"), email)
def test_should_return_count_of_ds_with_matching_email_and_short_code( self): count = datasender_count_with(email='*****@*****.**') self.assertEqual(count, 1)