Exemple #1
0
 def clean_email(self):
     if self.instance.pk != None:
         existing_user = UserModel().objects.filter(username__iexact=self.cleaned_data['email'])
         existing = Rolnik.objects.get(pk=self.instance.pk)
         if existing_user.exists() and existing.user != existing_user[0]:
             raise forms.ValidationError(_("This email belongs to someone else."))
         return self.cleaned_data['email']
     existing = UserModel().objects.filter(username__iexact=self.cleaned_data['email'])
     if existing.exists():
         raise forms.ValidationError(_("A user with that username already exists."))
     else:
         return self.cleaned_data['email']
Exemple #2
0
    def clean_email(self):

      existing = UserModel().objects.filter(email__iexact=self.cleaned_data['email'])
      if existing.exists():
        raise forms.ValidationError(_("A user with that email already exists."))
      else:
        return self.cleaned_data['email']
Exemple #3
0
    def clean_username(self):
        """
        Validate that the username is alphanumeric and is not already
        in use.

        """
        existing = UserModel().objects.filter(username__iexact=self.cleaned_data['username'])
        if existing.exists():
            raise forms.ValidationError(_("A user with that username already exists."))
        else:
            return self.cleaned_data['username']
    def clean_username(self):
        """
        Validate that the username is alphanumeric and is not already
        in use.

        """
        existing = UserModel().objects.filter(username__iexact=self.cleaned_data['username'])
        if existing.exists():
            raise forms.ValidationError(_("A user with that username already exists."))
        else:
            return self.cleaned_data['username']
    def clean_username(self):
        """
        Validate that the username is alphanumeric and is not already
        in use.

        """
        kwargs = {UserModel().USERNAME_FIELD: self.cleaned_data['username']}
        existing = UserModel().objects.filter(**kwargs)
        if existing.exists():
            raise forms.ValidationError(_("A user with that username already exists."))
        else:
            return self.cleaned_data['username']
Exemple #6
0
def validate_email(value):
    existing = UserModel().objects.filter(email__iexact=value)
    if not existing.exists():
        raise forms.ValidationError(
            _("A user with that email doesn't exists."))
Exemple #7
0
def validate_email(value):
    existing = UserModel().objects.filter(email__iexact=value)
    if not existing.exists():
        raise forms.ValidationError(_("A user with that email doesn't exists."))