class MyForm(forms.Form):
    name = forms.CharField(label='name')
    email = forms.EmailField(label='Email')
    ver_email = forms.EmailField(label='ver_email')
    message = forms.CharField(widget=forms.Textarea,
                              label='Message',
                              required=True,
                              validators=[validators.MaxLengthValidator(10)])

    def clean(self):
        all_clean = super().clean()
        email = all_clean['email']
        ver_email = all_clean['ver_email']
        if email != ver_email:
            raise forms.ValidationError('Verfiy from your email')
Exemplo n.º 2
0
class FormName(forms.Form):
    name = forms.CharField()
    email = forms.EmailField()
    verify_email = forms.EmailField(label='Enter your email again')
    text = forms.CharField(widget=forms.Textarea)
    botcatcher = forms.CharField(required=False,
                                widget=forms.HiddenInput,
                                validators=[validators.MaxLengthValidator(0)])

    def clean(self):
        all_clean = super().clean()
        email = all_clean['email']
        vmail = all_clean['verify_email']
        if email != vmail:
            raise forms.ValidationError("Make sure emails match")
Exemplo n.º 3
0
class FormName(forms.Form):
    name = forms.CharField(validators=[check_for_z])
    email = forms.EmailField()
    verify_email = forms.EmailField(label='Check your email again:')
    text = forms.CharField(widget=forms.Textarea)
    botcatcher = forms.CharField(required=False,
                                 widget=forms.HiddenInput,
                                 validators=[validators.MaxLengthValidator(0)])

    def clean(self):
        all_clean_data = super().clean()
        email = all_clean_data['email']
        vmail = all_clean_data['verify_email']
        if email != vmail:
            raise forms.ValidationError("MAKE SURE EMAILS MATCH")
Exemplo n.º 4
0
class NameForm(forms.Form):
    name = forms.CharField(validators=[check_for_a])
    email = forms.EmailField()
    verify_email = forms.EmailField(label="Enter your email again!")
    text = forms.CharField(widget=forms.Textarea,
                           validators=[validators.MaxLengthValidator(5)])

    def clean(self):
        cleaned_data = super().clean()
        email = cleaned_data['email']
        vmail = cleaned_data['verify_email']

        if email != vmail:
            raise forms.ValidationError('Make shure email match')
        return cleaned_data
Exemplo n.º 5
0
class FormName(forms.Form):
    name = forms.CharField(validators=[check_for_Z])
    email = forms.EmailField()
    verify_email = forms.EmailField(label="Re-enter email.")
    text = forms.CharField(widget=forms.Textarea)
    botcatcher = forms.CharField(required=False,
                                 widget=forms.HiddenInput,
                                 validators=[validators.MaxLengthValidator(0)])

    def clean(self):
        all_data = super().clean()
        email = all_data['email']
        vmail = all_data['verify_email']
        if email != vmail:
            raise forms.ValidationError("Email does not match.")
Exemplo n.º 6
0
class RegisterForm(forms.Form):
    user_name = forms.CharField(
        widget=forms.TextInput(
            attrs={'placeholder': 'لطفا نام کاربری خود را وارد نمایید'}),
        label='نام کاربری',
        validators=[
            validators.MaxLengthValidator(
                limit_value=20,
                message='تعداد کاراکترهای وارد شده نمیتواند بیشتر از 20 باشد'),
            validators.MinLengthValidator(
                8, 'تعداد کاراکترهای وارد شده نمیتواند کمتر از 8 باشد')
        ])

    email = forms.CharField(
        widget=forms.TextInput(
            attrs={'placeholder': 'لطفا ایمیل خود را وارد نمایید'}),
        label='ایمیل',
        validators=[validators.EmailValidator('ایمیل وارد شده معتبر نمیباشد')])

    password = forms.CharField(widget=forms.PasswordInput(
        attrs={'placeholder': 'لطفا کلمه عبور خود را وارد نمایید'}),
                               label='کلمه ی عبور')

    re_password = forms.CharField(widget=forms.PasswordInput(
        attrs={'placeholder': 'لطفا تکرار کلمه عبور خود را وارد نمایید'}),
                                  label='تکرار کلمه ی عبور')

    def clean_email(self):
        user_email = self.cleaned_data.get('email')
        is_exists_email = User.objects.filter(email=user_email).exists()
        if is_exists_email:
            raise forms.ValidationError('ایمیل وارد شده تکراری میباشد')

        if len(user_email) > 20:
            raise forms.ValidationError(
                'تعداد کاراکترهای ایمیل باید کمتر از 20 باشد')

        return user_email

    def clean_user_name(self):
        user_name = self.cleaned_data.get('user_name')
        is_exists_user_by_username = User.objects.filter(
            username=user_name).exists()

        if is_exists_user_by_username:
            raise forms.ValidationError('این کاربر قبلا ثبت نام کرده است')

        return user_name
Exemplo n.º 7
0
class RegisterForm(forms.Form):
    user_name = forms.CharField(
        widget=forms.TextInput(
            attrs={"placeholder": "لطفا نام کاربری خود را وارد نمایید"}),
        label='نام کاربری',
        validators=[
            validators.MaxLengthValidator(
                limit_value=20,
                message='تعداد کاراکترهای وارد شده نمیتواند بیشتراز 20 باشد'),
            validators.MinLengthValidator(
                8, 'تعداد کاراکترهای وارد شده نمیتواند کمتر از 8 باشد')
        ])
    email = forms.EmailField(
        widget=forms.EmailInput(
            attrs={"placeholder": "لطفا ایمیل خود را وارد نمایید "}),
        label='ایمیل',
        validators=[validators.EmailValidator('ایمیل وارد شده معتبر نمیباشد')])

    password = forms.CharField(widget=forms.PasswordInput(
        attrs={"placeholder": "لطفا کلمه عبور خود را وارد نمایید "}),
                               label='کلمه عبور')

    re_password = forms.CharField(widget=forms.PasswordInput(
        attrs={"placeholder": "لطفا تکرار کلمه عبور خود را وارد نمایید "}),
                                  label='تکرار کلمه عبور')

    def clean_email(self):
        email = self.cleaned_data.get('email')
        is_exist_email = User.objects.filter(email=email).exists()
        if is_exist_email:
            raise forms.ValidationError('ایمیل وارد شده تکراری میباشد')
        return email

    def clean_user_name(self):
        user_name = self.cleaned_data.get('user_name')
        is_exist_user = User.objects.filter(username=user_name).exists()
        if is_exist_user:
            raise forms.ValidationError('این کاربر قبلا ثبت نام کرده است')
        return user_name

        return user_name

    def clean_re_password(self):
        password = self.cleaned_data.get('password')
        re_password = self.cleaned_data.get('re_password')
        if password != re_password:
            raise forms.ValidationError('کلمه های عبور با هم مغایرت دارند')
        return password
Exemplo n.º 8
0
class LoginForm(forms.Form):
    name = forms.CharField()  #validators=[check_for_z])  # used custom validator
    email = forms.EmailField()
    verify_email = forms.EmailField(label="Enter your email again")
    text = forms.CharField(widget=forms.Textarea)
    botcatcher = forms.CharField(required=False,
                                 widget=forms.HiddenInput,
                                 validators=[validators.MaxLengthValidator(0)])

    # using a single clean for all variables
    def clean(self):
        all_clean_data = super().clean()
        email = all_clean_data['email']
        vmail = all_clean_data['verify_email']
        if email != vmail:
            raise forms.ValidationError("The emails don't match")
Exemplo n.º 9
0
class NewUserForm(forms.ModelForm):

    password = forms.CharField(
        label=_('Password'),
        widget=forms.PasswordInput,
        help_text=_('For your safety, use a minimum of 6 and \
                    maximum of 10 digits password.'),
        validators=[
            validators.MinLengthValidator(6),
            validators.MaxLengthValidator(10)
        ],
    )

    class Meta:
        model = User
        fields = ['username']
Exemplo n.º 10
0
class FormularioContacto(forms.Form):
    nombre = forms.CharField(
        validators = [
            validators.MinLengthValidator(4, "El nombre no puede ser menor a 4 letras"),
            validators.MaxLengthValidator(15, "El nombre no puede superar los 15 caracteres")   
        ]
    )
    email = forms.EmailField()

    mensaje = forms.CharField(
        widget = forms.Textarea,
        validators = [
            validators.MinLengthValidator(15, "El mensaje no puede ser menor a 15 caracteres")
        ]
    )
    forms.
Exemplo n.º 11
0
class FormName(forms.Form):
    name = forms.CharField(validators=[check_for_z])
    email = forms.EmailField()
    vemail = forms.EmailField(label='enter your email again ')
    text = forms.CharField(widget=forms.Textarea)
    botCatcher = forms.CharField(required=False, widget=forms.HiddenInput,
                                 validators=[validators.MaxLengthValidator(0)])

    def clean(self):
        all_data  = super().clean()
        email = all_data['email']
        vmail = all_data['vemail']


        if email!= vmail :
            raise forms.ValidationError("chof mli7")
Exemplo n.º 12
0
class Tag(models.Model):
    name = models.CharField(max_length=20, unique=True,
            verbose_name=_("name"), null=False, blank=False,
            validators=[
                validators.MinLengthValidator(3),
                validators.MaxLengthValidator(20),
                validators.validate_slug,
            ])
    problems = models.ManyToManyField(Problem, through='TagThrough')

    class Meta(object):
        verbose_name = _("tag")
        verbose_name_plural = _("tags")

    def __unicode__(self):
        return str(self.name)
Exemplo n.º 13
0
class FormName(forms.Form):
    name = forms.CharField(validators=[check_for_z])
    email = forms.EmailField()
    verifyemail = forms.EmailField(label='Enter your mail again')
    summary = forms.CharField(widget=forms.Textarea, validators=[maximum])
    botcatcher = forms.CharField(required=False,
                                 widget=forms.HiddenInput,
                                 validators=[validators.MaxLengthValidator(0)])

    def clean(self):
        allclean = super().clean()
        originalemail = allclean['email']
        vamil = allclean['verifyemail']

        if originalemail != vamil:
            raise forms.ValidationError('mails are not equal')
Exemplo n.º 14
0
class PostForm(forms.ModelForm):
    botcatcher = forms.CharField(required=False,
                                 widget=forms.HiddenInput,
                                 validators=[validators.MaxLengthValidator(0)])

    class Meta():
        model = Post
        fields = ('author', 'title', 'text')

        widgets = {
            'title':
            forms.TextInput(attrs={'class': 'textinputclass'}),
            'text':
            forms.Textarea(
                attrs={'class': 'editable medium-editor-textarea postcontent'})
        }
Exemplo n.º 15
0
class formName(forms.Form):
    name = forms.CharField()
    email=forms.EmailField()
    verify_Email=forms.EmailField(label='please enter the same email again : ')
    text = forms.CharField(widget=forms.Textarea)
    # setting up a hidden field in the form
    botcatcher = forms.CharField(required=False,
                                 widget=forms.HiddenInput,
                                validators=[validators.MaxLengthValidator(0)])
    
    def clean(self):
        all_clean_data = super().clean()
        email = all_clean_data['email']
        vmail = all_clean_data['verify_Email']
        if email !=vmail:
            raise forms.ValidationError('MAKE SURE EMAILS MATCH!')
Exemplo n.º 16
0
class SignUpForm(UserCreationForm):
    email = forms.EmailField(required=True)
    botcatcher = forms.CharField(required=False,
                                 widget=forms.HiddenInput,
                                 validators=[validators.MaxLengthValidator(0)])

    class Meta:
        model = User
        fields = ('username', 'email', 'password1', 'password2')

    def __init__(self, *args, **kwargs):
        super().__init__(*args, **kwargs)
        for field in ['username', 'email', 'password1', 'password2']:
            self.fields[field].help_text = None
            self.fields[field].widget.attrs['placeholder'] = self.fields[
                field].label
Exemplo n.º 17
0
class FormName(forms.Form):
    name = forms.CharField()
    email = forms.EmailField()
    verify_email = forms.EmailField(label='Verify your email Again')
    text = forms.CharField(widget=forms.Textarea)
    botcatcher = forms.CharField(required=False,
                                 widget=forms.HiddenInput,
                                 validators=[validators.MaxLengthValidator(0)])

    def clean(self):
        # Get all cleaned data
        all_clean_data = super().clean()
        email = all_clean_data.get('email')
        vmail = all_clean_data.get('verify_email')
        if email != vmail:
            raise forms.ValidationError("Make sure that emails match")
Exemplo n.º 18
0
class FormName(forms.Form):
    name = forms.CharField(validators=[check_for_z])
    email = forms.EmailField()
    verify_email = forms.EmailField()
    text = forms.CharField(widget=forms.Textarea)
    #catch bots on the form_page
    botcatcher = forms.CharField(required=False,
                                 widget=forms.HiddenInput,
                                 validators=[validators.MaxLengthValidator(0)])

    def clean(self):
        all_clean_data = super().clean()
        email = all_clean_data['email']
        v_email = all_clean_data['verify_email']
        if email != v_email:
            raise forms.ValidationError("Make sure emails match!")
Exemplo n.º 19
0
class FormName(forms.Form):
    name = forms.CharField(max_length=100)
    email = forms.EmailField()
    verify_email = forms.EmailField(label="Verify Email")
    text = forms.CharField(widget=forms.Textarea)
    botcat = forms.CharField(required=False,
                             widget=forms.HiddenInput,
                             validators=[validators.MaxLengthValidator(0)])

    def clean(self):
        all_clean_data = super().clean()
        email = all_clean_data['email']
        vemail = all_clean_data['verify_email']

        if email != vemail:
            raise forms.ValidationError("Provided emails do not match")
Exemplo n.º 20
0
class FormName(forms.Form):
    """docstring for FormName"""
    name = forms.CharField()
    email = forms.EmailField()
    verify_email = forms.EmailField(label='Re enter the email')
    text = forms.CharField(widget=forms.Textarea)
    botcatcher = forms.CharField(required=False,
                                 widget=forms.HiddenInput,
                                 validators=[validators.MaxLengthValidator(0)])

    def clean(self):
        all_clean_data = super().clean()
        email = all_clean_data['email']
        vmail = all_clean_data['verify_email']
        if email != vmail:
            raise forms.ValidationError("Make Sure Email matches")
Exemplo n.º 21
0
class formName(forms.Form):
    name = forms.CharField(validators=[check_for_z])
    email = forms.EmailField()
    verify_email = forms.EmailField(label='type email again')
    text = forms.CharField(widget=forms.Textarea)
    botcatcher = forms.CharField(required=False,
                                 widget=forms.HiddenInput,
                                 validators=[validators.MaxLengthValidator(0)])

    def clean(self):
        all_clean_data = super().clean()
        email = all_clean_data['email']
        another = all_clean_data['verify_email']

        if email != another:
            raise forms.ValidationError("both email must be same")
Exemplo n.º 22
0
class FormName(forms.Form):
    name = forms.CharField(label="Name: ", validators=[name_validation])
    email = forms.EmailField(label="Email: ")
    verify_email = forms.EmailField(label="Enter Email Again: ")
    text = forms.CharField(label="Enter message: ", widget=forms.Textarea)
    botcatcher = forms.CharField(required=False,
                                 widget=forms.HiddenInput,
                                 validators=[validators.MaxLengthValidator(0)])

    def clean(self):
        all_clean_data = super().clean()
        email = all_clean_data['email']
        vemail = all_clean_data['verify_email']

        if email != vemail:
            raise forms.ValidationError('Email mismatch')
Exemplo n.º 23
0
class FormName(forms.Form):
    name = forms.CharField()
    # email = forms.EmailField(validators=[check_er])
    email = forms.EmailField(validators=[check_er])
    verify_email = forms.EmailField(label="Please enter your mail again: ")
    text = forms.CharField(widget=forms.Textarea)
    botcatcher = forms.CharField(required=False,
                                 widget=forms.HiddenInput,
                                 validators=[validators.MaxLengthValidator(0)])

    def clean(self):
        all_neat = super().clean()
        email = all_neat['email']
        vemail = all_neat['verify_email']
        if email != vemail:
            raise forms.ValidationError("Please Check Your Email")
Exemplo n.º 24
0
class FormName(forms.Form):
    name = forms.CharField(max_length=64,)
    email = forms.EmailField()
    vmail = forms.EmailField(label='Enter your email again:')
    text = forms.CharField(widget=forms.Textarea)

    botcatcher = forms.CharField(
        required=False,
        widget=forms.HiddenInput,
        validators=[validators.MaxLengthValidator(0)]
    )

    def clean(self):
        form = super().clean()
        if form['email'] != form['vmail']:
            raise forms.ValidationError('Emails not matched!')
Exemplo n.º 25
0
class FormName(forms.Form):
    name = forms.CharField()
    email = forms.EmailField()
    v_email = forms.EmailField(label='Verified Email: ')
    text = forms.CharField(widget=forms.Textarea)
    botCatcher = forms.CharField(required=False,
                                 widget=forms.HiddenInput,
                                 validators=[validators.MaxLengthValidator(0)])

    def clean(self):
        all_clean_data = super().clean()
        email = all_clean_data['email'].lower()
        v_email = all_clean_data['v_email'].lower()

        if email != v_email:
            raise forms.ValidationError("Email not match")
Exemplo n.º 26
0
class ContactUsForm(forms.Form):
    email = forms.CharField(widget=forms.TextInput(attrs={'id': 'email'}),
                            required=True)
    user_name = forms.CharField(widget=forms.TextInput(attrs={'id': 'name'}),
                                required=True)
    user_phone = forms.CharField(
        widget=forms.TextInput(attrs={'id': 'phone_number'}), required=False)
    text = forms.CharField(widget=forms.TextInput(
        attrs={
            'id': 'text',
            'class': 'materialize-textarea',
            'style': "height: 100px"
        }))
    Hfield = forms.CharField(required=False,
                             widget=forms.HiddenInput,
                             validators=[validators.MaxLengthValidator(0)])
Exemplo n.º 27
0
class UserForm(forms.Form):
    first_name = forms.CharField(validators=[check_for_z])
    last_name = forms.CharField()
    email = forms.EmailField()
    veryfy_email = forms.EmailField()
    text = forms.CharField(widget=forms.Textarea)
    botcatcher = forms.CharField(required=False,
                                 widget=forms.HiddenInput,
                                 validators=[validators.MaxLengthValidator(0)])

    def clean(self):
        all_clean_data = super().clean()
        email = all_clean_data['email']
        vmail = all_clean_data['veryfy_email']
        if email != vmail:
            raise forms.ValidationError('Email dont match check again')
Exemplo n.º 28
0
class SportClubContactForm(forms.Form):
    name = forms.CharField(widget=forms.TextInput(attrs={'id': 'name'}),
                           required=True)
    sportclub_name = forms.CharField(
        widget=forms.TextInput(attrs={'id': 'sportclub_name'}), required=True)
    phone = forms.CharField(widget=forms.TextInput(attrs={'id': 'phone'}),
                            required=True)
    address = forms.CharField(widget=forms.Textarea(
        attrs={
            'id': 'address',
            'class': 'materialize-textarea',
            'style': "height: 80px"
        }))
    Hfield = forms.CharField(required=False,
                             widget=forms.HiddenInput,
                             validators=[validators.MaxLengthValidator(0)])
Exemplo n.º 29
0
 def __init__(self,
              max_length=None,
              min_length=None,
              strip=True,
              *args,
              **kwargs):
     self.max_length = max_length
     self.min_length = min_length
     self.strip = strip
     super(CharField, self).__init__(*args, **kwargs)
     if min_length is not None:
         self.validators.append(
             validators.MinLengthValidator(int(min_length)))
     if max_length is not None:
         self.validators.append(
             validators.MaxLengthValidator(int(max_length)))
Exemplo n.º 30
0
class Profile(models.Model):
    name = models.CharField(max_length=30)
    age = models.IntegerField(
        validators=(
            validators.MinValueValidator(0),
            validators.MaxValueValidator(150),
        )
    )
    egn = models.CharField(
        max_length=10,
        validators=(
            validators.MinLengthValidator(10),
            validators.MaxLengthValidator(10),
            contains_only_digits_validator,
        )
    )