Exemplo n.º 1
0
class CheckoutForm(forms.Form):
    first_name = forms.CharField()
    last_name = forms.CharField()
    email = forms.EmailField()
    phone = forms.CharField()
    country = forms.ChoiceField(choices=COUNTRY_CHOICES)
    city = forms.CharField()
    post_code = forms.IntegerField()
    address = forms.CharField()
    additional_info = forms.CharField(widget=forms.Textarea)
    card_type = forms.ChoiceField(choices=(('V', 'Visa'), ('M', 'MasterCard'),
                                           ('P', 'Paypal')),
                                  widget=forms.RadioSelect)
    card_holder = forms.CharField(label="Name on card")
    card_number = forms.CharField(label="Card number")
    card_ccv2 = forms.IntegerField(label="CVV2")
    card_exp_month = forms.ChoiceField(
        choices=((1, 'January'), (2, 'February'), (3, 'March'), (4, 'April'),
                 (5, 'May'), (6, 'June'), (7, 'July'), (8, 'August'),
                 (9, 'September'), (10, 'October'), (11, 'November'),
                 (12, 'December')))
    card_exp_year = forms.IntegerField(label="Year")

    layout = Layout(
        Row('first_name', 'last_name'), Row('email', 'phone'),
        Row(Span5('country'), Span5('city'), Span2('post_code')), 'address',
        'additional_info',
        Fieldset(
            'Card Details',
            Row(
                Column('card_type', span_columns=4),
                Column('card_holder',
                       Row(Span10('card_number'), Span2('card_ccv2')),
                       Row('card_exp_month', 'card_exp_year'),
                       span_columns=8))))

    template = Template("""
    {% form %}
        {% part form.first_name prefix %}<i class="material-icons prefix">account_box</i>{% endpart %}
        {% part form.last_name prefix %}<i class="material-icons prefix">account_box</i>{% endpart %}
        {% part form.email prefix %}<i class="material-icons prefix">email</i>{% endpart %}
        {% part form.phone prefix %}<i class="material-icons prefix">call</i>{% endpart %}
        {% part form.card_type label %}{% endpart %}
    {% endform %}
    """)

    buttons = Template("""
        <button class="btn btn-primary pull-right" type="submit">Submit request</button>
    """)

    title = "Checkout form"

    css = """
class LayoutForm(forms.Form):
    test_field1 = forms.CharField()
    test_field2 = forms.CharField()
    test_field3 = forms.CharField()
    test_field4 = forms.CharField()
    test_field5 = forms.CharField()

    layout = Layout(Row('test_field1', 'test_field2'),
                    Row('test_field3', Column('test_field4', 'test_field5')))
Exemplo n.º 3
0
class ContactForm(forms.ModelForm):
    layout = Layout(
        'bank',
        Fieldset("Bank Contacts", Row('phone', 'fax'), Row('email', 'website'),
                 Row('swift_code', 'contact_center')),
        Fieldset("Address", Row(Column('address_line', 'building_name'),
                                'city')))

    class Meta:
        model = Contact
        fields = '__all__'
Exemplo n.º 4
0
class BankForm(forms.ModelForm):
    # category = forms.ChoiceField(
    #     choices=Bank.OWNERSHIP,
    #     label='Bank Category',
    #     widget=forms.RadioSelect)
    # group = forms.ChoiceField(
    #     choices=Bank.BUKU, label='BUKU', widget=forms.RadioSelect)
    layout = Layout(
        Fieldset(
            "Institution Data", 'institution_name', 'bank_name',
            Row(Column('est_date', 'forex_date', 'listing_date'),
                Column('tin', 'logo'))),
        Fieldset("Bank Details", Row('category', 'group')))

    class Meta:
        model = Bank
        exclude = ['periods']
        widgets = {
            # 'logo': forms.FileInput(attrs={'class': 'dropify'}),
            'est_date': forms.DateInput(attrs={'class': 'datepicker'}),
            'forex_date': forms.DateInput(attrs={'class': 'datepicker'}),
            'listing_date': forms.DateInput(attrs={'class': 'datepicker'}),
        }
Exemplo n.º 5
0
class RegistrationForm(forms.Form):
    class EmergencyContractForm(forms.Form):
        name = forms.CharField()
        relationship = forms.CharField()
        daytime_phone = forms.CharField()
        evening_phone = forms.CharField(required=False)

    registration_date = forms.DateField(initial=datetime.date.today)
    full_name = forms.CharField()
    birth_date = forms.DateField()
    height = forms.IntegerField(help_text='cm')
    weight = forms.IntegerField(help_text='kg')
    primary_care_physician = forms.CharField()
    date_of_last_appointment = forms.DateField()
    home_phone = forms.CharField()
    work_phone = forms.CharField(required=False)

    procedural_questions = forms.MultipleChoiceField(
        widget=forms.CheckboxSelectMultiple,
        required=False,
        choices=QUESTION_CHOICES)

    cardiovascular_risks = forms.MultipleChoiceField(
        widget=forms.CheckboxSelectMultiple,
        required=False,
        choices=CARDIOVASCULAR_RISK_CHOICES)

    apnia_risks = forms.MultipleChoiceField(
        widget=forms.CheckboxSelectMultiple,
        required=False,
        choices=APNIA_RISK_CHOICES)

    layout = Layout(
        Row(
            Column('full_name',
                   'birth_date',
                   Row('height', 'weight'),
                   span_columns=3), 'registration_date'),
        Row(Span3('primary_care_physician'), 'date_of_last_appointment'),
        Row('home_phone', 'work_phone'),
        Fieldset('Procedural Questions', 'procedural_questions'),
        Fieldset('Clinical Predictores of Cardiovascular Risk',
                 'cardiovascular_risks'),
        Fieldset('Clinical Predictors of sleep Apnia Risk', 'apnia_risks'),
        Fieldset('Emergence Numbers', 'emergency_numbers'))
Exemplo n.º 6
0
class ProductsAndServicesForm(forms.ModelForm):
    layout = Layout(
        Row('products_and_services_score'),
        Row(Span4('products_and_services_justification'), Column())
    )

    class Meta:
        model = GrantManagementProcess
        fields = ['products_and_services_score', 'products_and_services_justification']

    products_and_services_score = forms.IntegerField(
        label=SCORE_LABEL,
        widget=forms.RadioSelect(choices=GrantManagementProcess.ScoreChoices.choices)
    )
    products_and_services_justification = forms.CharField(
        label=RATIONALE_LABEL,
        widget=forms.Textarea(
            attrs={'placeholder': RATIONALE_PLACEHOLDER}
        )
    )
Exemplo n.º 7
0
class ExportStrategyForm(forms.ModelForm):
    layout = Layout(
        Row('export_strategy_score'),
        Row(Span4('export_strategy_justification'), Column())
    )

    class Meta:
        model = GrantManagementProcess
        fields = ['export_strategy_score', 'export_strategy_justification']

    export_strategy_score = forms.IntegerField(
        label='Score',
        widget=forms.RadioSelect(choices=GrantManagementProcess.ScoreChoices.choices)
    )
    export_strategy_justification = forms.CharField(
        label=RATIONALE_LABEL,
        widget=forms.Textarea(
            attrs={'placeholder': RATIONALE_PLACEHOLDER}
        )
    )
Exemplo n.º 8
0
class BankForm(forms.Form):
    branch_name = forms.CharField()
    """ Personal Details """
    person_title = forms.ChoiceField(choices=(('Mr', 'Mr.'), ('Mrs.', 'Mrs.'),
                                              ('Ms.', 'Ms.')),
                                     label='Title')
    full_name = forms.CharField()
    date_of_birth = forms.DateField()
    email = forms.EmailField()
    parent_name = forms.CharField(
        label='In case of a minor please provide details')
    nationality = forms.ChoiceField(choices=COUNTRY_CHOICES)
    mobile_no = forms.CharField()
    existing_bank_account = forms.CharField()
    partner_name = forms.CharField(label='Name of father/spouse')
    """ Residential address """
    flat_bulding = forms.CharField(label='Flat no. and bldg. name')
    road_no = forms.CharField(label='Road no./name')
    area_and_landmark = forms.CharField(label='Area and landmark')
    telephone_residence = forms.CharField()
    city = forms.CharField()
    office = forms.CharField()
    fax = forms.CharField()
    pin_code = forms.CharField()
    """ Mailing Address """
    mailing_company_details = forms.CharField(
        label="Company name and department/ Flat no. and bldg. name")
    mailing_road_no = forms.CharField(label='Road no./name')
    mailing_area_and_landmark = forms.CharField(label='Area and landmark')
    mailing_city = forms.CharField(label='City')
    mailing_mobile = forms.CharField(label='Mobile No.')
    mailing_telephone_residence = forms.CharField(label='Telephone Residence')
    mailing_office = forms.CharField(label='Office')
    mailing_fax = forms.CharField(label='Fax')
    mailing_pin_code = forms.CharField(label='Pin Code')
    mailing_email = forms.EmailField(label='E-mail')
    """ Details of Introduction by Existing Customer """
    introducer_name = forms.CharField(label='Customer Name')
    introducer_account_no = forms.CharField(label='Account No.')
    introducer_signature = forms.CharField(label="Introducer's signature")
    """ Account Details """
    account_type = forms.ChoiceField(choices=(('S', 'Savings'), ('C',
                                                                 'Current'),
                                              ('F', 'Fixed deposits')),
                                     label='Choice of account',
                                     widget=forms.RadioSelect)
    account_mode = forms.ChoiceField(choices=(('CS', 'Cash'), ('CQ', 'Cheque'),
                                              ('NF', 'NEFT')),
                                     label='Mode of funding',
                                     widget=forms.RadioSelect)
    account_amount = forms.FloatField(label='Amount')
    """ Details of Fixed Deposit """
    deposit_type = forms.ChoiceField(choices=(('O', 'Ordinary'),
                                              ('C', 'Cumulative')),
                                     label='Types of deposit',
                                     widget=forms.RadioSelect)
    deposit_mode = forms.ChoiceField(choices=(('CS', 'Cash'), ('CQ', 'Cheque'),
                                              ('NF', 'NEFT')),
                                     label='Mode of funding',
                                     widget=forms.RadioSelect)
    deposit_amount = forms.FloatField(label='Amount')
    deposit_no = forms.CharField(label='No. of deposits')
    deposit_individual_amount = forms.FloatField(
        label='Individual Deposit Amount')
    """ Personal Details """
    occupation = forms.ChoiceField(
        choices=(('NE', 'Non-executive'), ('HW', 'Housewife'), ('RT',
                                                                'Retired'),
                 ('ST', 'Student'), ('OT', 'Other'), ('UN', 'Unemployed')),
        widget=forms.RadioSelect)
    job_title = forms.CharField()
    department = forms.CharField()
    nature_of_business = forms.CharField()
    education = forms.ChoiceField(choices=(('UG', 'Under graduate'),
                                           ('GR', 'Graduate'), ('OT',
                                                                'Others')),
                                  widget=forms.RadioSelect)
    montly_income = forms.ChoiceField(choices=(('000', 'Zero Income'),
                                               ('L10', 'Less than $10,000'),
                                               ('G10', '$10,000+')),
                                      widget=forms.RadioSelect)
    martial_status = forms.ChoiceField(choices=(('M', 'Married'), ('S',
                                                                   'Single')),
                                       widget=forms.RadioSelect)
    spouse_name = forms.CharField()
    """ Other existing bank accounts, if any """
    other_account1 = forms.CharField(label='Name of the Bank / branch')
    other_account2 = forms.CharField(label='Name of the Bank / branch')
    """ Reason for Account opening """
    reason = forms.CharField(label="Please specify", widget=forms.Textarea)
    """ Terms And Conditions """
    terms_accepted = forms.BooleanField(
        label=
        "I/We confirm having read and understood the account rules of The Banking Corporation Limited"
        " ('the Bank'), and hereby agree to be bound by the terms and conditions and amendments governing the"
        " account(s) issued by the Bank from time-to-time.")

    layout = Layout(
        Fieldset("Please open an account at", 'branch_name'),
        Fieldset(
            "Personal Details (Sole/First Accountholder/Minor)",
            Row(Span2('person_title'), Span10('full_name')),
            Row(
                Column('date_of_birth', 'email', 'parent_name'),
                Column('nationality', Row('mobile_no',
                                          'existing_bank_account'),
                       'partner_name'))),
        Fieldset('Residential address', Row('flat_bulding', 'road_no'),
                 Row(Span10('area_and_landmark'), Span2('city')),
                 Row('telephone_residence', 'office', 'fax', 'pin_code')),
        Fieldset(
            "Mailing Address (If different from the First Accountholder's address)",
            'mailing_company_details',
            Row('mailing_road_no', 'mailing_area_and_landmark', 'mailing_city',
                'mailing_mobile'),
            Row('mailing_telephone_residence', 'mailing_office', 'mailing_fax',
                'mailing_pin_code'), 'mailing_email'),
        Fieldset(
            "Details of Introduction by Existing Customer (If applicable)",
            Row('introducer_name', 'introducer_account_no'),
            'introducer_signature'),
        Fieldset("Account Details", Row('account_type', 'account_mode'),
                 'account_amount'),
        Fieldset(
            "Details of Fixed Deposit", Row('deposit_type', 'deposit_mode'),
            Row(Span6('deposit_amount'), Span3('deposit_no'),
                Span3('deposit_individual_amount'))),
        Fieldset("Personal Details",
                 Row('occupation', 'education', 'montly_income'), 'job_title',
                 Row('department', 'nature_of_business'),
                 Row('martial_status', 'spouse_name')),
        Fieldset("Other existing bank accounts, if any",
                 Row('other_account1', 'other_account2')),
        Fieldset("Reason for Account opening", 'reason'),
        Fieldset("Terms And Conditions", 'terms_accepted'))

    template = Template("""
    {% form %}
        {% attr form.account_type 'group' class append %}inline{% endattr %}
        {% attr form.account_mode 'group' class append %}inline{% endattr %}
        {% attr form.deposit_type 'group' class append %}inline{% endattr %}
        {% attr form.deposit_mode 'group' class append %}inline{% endattr %}
        {% attr form.martial_status 'group' class append %}inline{% endattr %}
    {% endform %}
    """)

    buttons = Template("""
        <button class="btn btn-primary pull-right" type="submit">Save application</button>
    """)

    title = "Personal Bank Account Initial Application"

    css = """
    .section h5 {
        font-size: 1.2rem;
        padding-bottom: 0.2rem;
        border-bottom: 3px solid black;
    }
    """

    blockclass = "col s12 m12 l9 offset-l1"
class HospitalRegistrationForm(forms.Form):
    class EmergencyContractForm(forms.Form):
        name = forms.CharField()
        relationship = forms.CharField()
        daytime_phone = forms.CharField()
        evening_phone = forms.CharField(required=False)

    registration_date = forms.DateField(initial=datetime.date.today)
    full_name = forms.CharField()
    birth_date = forms.DateField()
    height = forms.IntegerField(help_text='cm')
    weight = forms.IntegerField(help_text='kg')
    primary_care_physician = forms.CharField()
    date_of_last_appointment = forms.DateField()
    home_phone = forms.CharField()
    work_phone = forms.CharField(required=False)

    procedural_questions = forms.MultipleChoiceField(
        widget=forms.CheckboxSelectMultiple, required=False,
        choices=QUESTION_CHOICES)

    cardiovascular_risks = forms.MultipleChoiceField(
        widget=forms.CheckboxSelectMultiple, required=False,
        choices=CARDIOVASCULAR_RISK_CHOICES)

    apnia_risks = forms.MultipleChoiceField(
        widget=forms.CheckboxSelectMultiple, required=False,
        choices=APNIA_RISK_CHOICES)

    emergency_numbers = FormSetField(formset_factory(EmergencyContractForm, extra=2, can_delete=True))

    layout = Layout(Row(Column('full_name', 'birth_date',
                               Row('height', 'weight'), span_columns=3), 'registration_date'),
                    Row(Span3('primary_care_physician'), 'date_of_last_appointment'),
                    Row('home_phone', 'work_phone'),
                    Fieldset('Procedural Questions', 'procedural_questions'),
                    Fieldset('Clinical Predictores of Cardiovascular Risk', 'cardiovascular_risks'),
                    Fieldset('Clinical Predictors of sleep Apnia Risk', 'apnia_risks'),
                    Fieldset('Emergence Numbers', 'emergency_numbers'))

    template = Template("""
    {% form %}
        {% part form.registration_date prefix %}<i class="mdi-editor-insert-invitation prefix"></i>{% endpart %}
        {% part form.date_of_last_appointment prefix %}<i class="mdi-editor-insert-invitation prefix"></i>{% endpart %}
        {% part form.primary_care_physician prefix %}<i class="mdi-action-face-unlock prefix"></i>{% endpart %}
        {% part form.home_phone prefix %}<i class="mdi-communication-call prefix"></i>{% endpart %}
        {% part form.work_phone prefix %}<i class="mdi-communication-call prefix"></i>{% endpart %}
        {% part form.procedural_questions label %}{% endpart %}
        {% part form.cardiovascular_risks label %}{% endpart %}
        {% part form.cardiovascular_risks columns %}2{% endpart %}
        {% part form.apnia_risks label %}{% endpart %}
        {% part form.apnia_risks columns %}3{% endpart %}
        {% part form.emergency_numbers label %}{% endpart %}

    {% endform %}
    """)

    buttons = Template("""
        <button class="btn btn-primary pull-right" type="submit">Registration</button>
    """)

    title = "Hospital registration form"

    css = """
    .section h5 {
        font-size: 1.2rem;
        padding-bottom: 0.2rem;
        border-bottom: 3px solid black;
    }
    """

    blockclass = "col s12 m12 l9 offset-l1"
Exemplo n.º 10
0
class RegistrationForm(forms.Form):
    Name = forms.CharField(max_length=80,
                           label='Name',
                           widget=forms.TextInput(
                               attrs={
                                   'type': 'text',
                                   'id': 'icon_prefix',
                                   'class': 'validate',
                                   'name': 'name'
                               }))

    Contact = forms.IntegerField(widget=forms.NumberInput(
        attrs={
            'type': 'number',
            'id': 'icon_telephone',
            'class': 'validate',
            'name': 'contact'
        }),
                                 label='Contact No.')
    Email = forms.EmailField(
        widget=forms.TextInput(attrs={
            'type': 'text',
            'id': 'email',
            'class': 'validate'
        }),
        label="Email")

    StudentNo = forms.CharField(widget=forms.TextInput(
        attrs={
            'type': 'text',
            'id': 'icon_student',
            'class': 'validate',
            'name': 'student_no'
        }),
                                label='Student No.')

    Branch = forms.ChoiceField(widget=forms.Select(
        attrs={
            'type': 'text',
            'id': 'branch',
            'class': 'select-dropdown',
            'name': 'Branch'
        }),
                               label='Choose your branch name',
                               choices=BRANCH_CHOICES,
                               required=True)

    Hosteler = forms.ChoiceField(
        widget=forms.RadioSelect(attrs={
            'type': 'radio',
            'id': 'test1',
            'name': 'group1'
        }),
        label='Are you a Hosteler?',
        choices=YES_OR_NO,
        required=True)

    Skills = forms.CharField(
        widget=forms.TextInput(
            attrs={
                'type': 'text',
                'id': 'skills_area',
                'class': 'validate',
                'name': 'skills'
            }),
        label='Mention your Technical skills e.g HTML, CSS, PHP, etc')

    Designer = forms.CharField(
        widget=forms.Textarea(
            attrs={
                'type': 'textarea',
                'id': 'designer_area',
                'class': 'validate',
                'name': 'skills'
            }),
        label='Any Designing Software used like Photostop,etc',
        required=False,
    )

    layout = Layout(Row('Name', 'StudentNo'), Row('Email', 'Contact'),
                    Row('Branch'), Row('Skills'),
                    Row(Column('Hosteler'), Column('Designer')))

    def clean_Contact(self):
        contact = self.cleaned_data.get('Contact')
        if len(str(contact)) != 10:
            raise forms.ValidationError("Invalid length of mobile number")
        return contact

    def clean_Email(self):
        email = self.cleaned_data.get("Email")

        pattern = "(^[a-zA-Z0-9_.+-]+@[a-zA-Z0-9-]+\.[a-zA-Z0-9-.]+$)"
        prog = re.compile(pattern)
        result = prog.match(email)

        if not bool(result):
            raise forms.ValidationError(
                "Invalid Email address. Use a valid email address.")

        return email

    def clean_StudentNo(self):

        std = self.cleaned_data.get('StudentNo')
        pattern = '^\d{7}[Dd]{0,1}$'
        prog = re.compile(pattern)
        result = prog.match(std)

        if Student.objects.all().filter(student_no=std).exists():
            raise forms.ValidationError(
                "Roll Number already exist in data base")

        if not bool(result):
            raise forms.ValidationError("Invalid format of Roll number ")
        return std
Exemplo n.º 11
0
class ApplicantForm(forms.ModelForm):
    name = forms.CharField()
    surname = forms.CharField()
    school = forms.ChoiceField(choices=(('En', 'Engineering'),
                                        ('Ph', 'Philology'), ('L', 'Law'),
                                        ('Bu', 'Business Administration')))
    major = forms.CharField()
    gender = forms.ChoiceField(choices=(('F', 'Female'), ('M', 'Male'),
                                        ('O', 'Other')),
                               widget=forms.RadioSelect)
    address = forms.CharField()
    date_of_birth = forms.DateField()
    nationality = forms.CharField()
    email = forms.EmailField()
    phone = forms.CharField()
    related = forms.ChoiceField(label="Where you heard about us?",
                                choices=(('Friends', 'Friends'), ('Relatives',
                                                                  'Relatives'),
                                         ('KTL', 'KTL'), ('Dostyk', 'Dostyk'),
                                         ('Internet', 'Internet'), ('Other',
                                                                    'Other')),
                                widget=forms.RadioSelect)
    entry_year = forms.CharField()
    graduation_year = forms.CharField()
    level = forms.ChoiceField(choices=(('BA', 'Bachelor'), ('MSc', 'Masters'),
                                       ('PHD', 'Doctor of Philosophy')))
    student_type = forms.ChoiceField(choices=(('P', 'Preparation'),
                                              ('1', 'Freshman'), ('2',
                                                                  'Sophomore'),
                                              ('3', 'Junior'), ('4',
                                                                'Senior')))
    passport_id = forms.CharField()
    number = forms.CharField()
    unt = forms.ChoiceField(label='UNT',
                            choices=(
                                ('125', '125'),
                                ('124', '124'),
                                ('123', '123'),
                                ('122', '122'),
                                ('121', '121'),
                                ('120', '120'),
                                ('119', '119'),
                                ('118', '118'),
                                ('117', '117'),
                                ('116', '116'),
                                ('115', '115'),
                                ('114', '114'),
                                ('113', '113'),
                                ('112', '112'),
                                ('111', '111'),
                                ('110', '110'),
                            ))
    attestat_number = forms.CharField()
    attestat_date = forms.DateField()
    attestat_type = forms.ChoiceField(choices=(('R', 'Regular'),
                                               ('H', 'With Honor'),
                                               ('A', 'Altyn Belgi')),
                                      widget=forms.RadioSelect)
    payment = forms.ChoiceField(choices=(('GG', 'Grant'), ('SG', 'SDU Grant'),
                                         ('P', 'Paid')),
                                widget=forms.RadioSelect)
    certificate_number = forms.CharField()

    layout = Layout(
        Fieldset(
            'General Information',
            Row('name', 'surname', 'gender'),
            Row(
                'school',
                'major',
            ),
            'address',
            Row(Span3('date_of_birth'), Span3('nationality'), Span3('phone'),
                Span3('email')),
        ),
        Fieldset('Educational Data', Row('level', 'student_type'),
                 'entry_year', 'graduation_year',
                 Row('attestat_number',
                     'attestat_type'), 'unt', 'certificate_number', 'payment'),
        Fieldset('Documentation',
                 Row(Column(('passport_id'), ('number')), 'related')))

    class Meta:
        model = Applicant
        fields = ('name', 'surname', 'school', 'major', 'gender', 'address',
                  'date_of_birth', 'nationality', 'father', 'mother', 'phone',
                  'email', 'related', 'entry_year', 'graduation_year', 'level',
                  'student_type', 'passport_id', 'number', 'unt',
                  'attestat_number', 'attestat_date', 'attestat_type',
                  'payment', 'certificate_number')
Exemplo n.º 12
0
class RegistrationForm(forms.Form):
    Name = forms.CharField(max_length=80,
                           label='Name',
                           widget=forms.TextInput(
                               attrs={
                                   'type': 'text',
                                   'id': 'icon_prefix',
                                   'class': 'validate register',
                                   'name': 'name'
                               }))

    Contact = forms.IntegerField(widget=forms.NumberInput(
        attrs={
            'type': 'number',
            'id': 'icon_telephone',
            'class': 'validate register',
            'name': 'contact'
        }),
                                 label='Contact No.')
    Email = forms.EmailField(
        widget=forms.TextInput(attrs={
            'type': 'text',
            'id': 'email',
            'class': 'validate register'
        }),
        label="Email")
    Password = forms.CharField(
        widget=forms.PasswordInput(attrs={"class": "validate register"}),
        label="Password")

    Cnf_Password = forms.CharField(
        widget=forms.PasswordInput(attrs={"class": "validate register"}),
        label="Confirm Password")

    StudentNo = forms.CharField(widget=forms.TextInput(
        attrs={
            'type': 'text',
            'id': 'icon_student',
            'class': 'validate register',
            'name': 'student_no'
        }),
                                label='Student No.')

    Branch = forms.ChoiceField(widget=forms.Select(
        attrs={
            'type': 'text',
            'id': 'branch',
            'class': 'select-dropdown ',
            'name': 'Branch'
        }),
                               label='Choose your branch name',
                               choices=BRANCH_CHOICES,
                               required=True)

    Hosteler = forms.ChoiceField(
        widget=forms.RadioSelect(attrs={
            'type': 'radio',
            'id': 'test1',
            'name': 'group1'
        }),
        label='Are you a Hosteler?',
        choices=YES_OR_NO,
        required=True)

    Skills = forms.CharField(
        widget=forms.TextInput(
            attrs={
                'type': 'text',
                'id': 'skills_area',
                'class': 'validate ',
                'name': 'skills'
            }),
        label='Mention your Technical skills e.g HTML, CSS, PHP, etc')

    Designer = forms.CharField(
        widget=forms.Textarea(
            attrs={
                'type': 'textarea',
                'id': 'designer_area',
                'class': 'validate register',
                'name': 'skills'
            }),
        label='Any Designing Software used like Photostop,etc',
        required=False,
    )

    layout = Layout(Row('Name', 'StudentNo'), Row('Email', 'Contact'),
                    Row('Password', 'Cnf_Password'), Row('Branch'),
                    Row('Skills'), Row(Column('Hosteler'), Column('Designer')))

    def clean_Name(self):
        name = self.cleaned_data.get('Name')

        pat = "^[A-Za-z\s]{1,}[\.]{0,1}[A-Za-z\s]{0,}$"
        pro = re.compile(pat)
        result = pro.match(name)

        if not bool(result):
            raise forms.ValidationError("Invalid Name format")

        if len(str(name)) > 100:
            raise forms.ValidationError("Invalid length ")

        return name

    def clean_Skills(self):
        skills = self.cleaned_data.get('Skills')

        if len(str(skills)) > 1500:
            raise forms.ValidationError("Invalid length ")

        return skills

    def clean_Designer(self):
        dsg = self.cleaned_data.get("Designer")

        if len(str(dsg)) > 200:
            raise forms.ValidationError("Invalid length ")

        return dsg

    def clean_Contact(self):
        contact = self.cleaned_data.get('Contact')
        patt = "^[7-9][0-9]{9}"
        pro = re.compile(patt)
        result = pro.match(str(contact))

        if not bool(result):
            raise forms.ValidationError("Invalid Contact number format ")

        if len(str(contact)) != 10:
            raise forms.ValidationError("Invalid Contact number format ")
        return contact

    def clean_Email(self):
        email = self.cleaned_data.get("Email")

        pattern = "^([a-zA-Z0-9_\-\.]+)@([a-zA-Z0-9_\-\.]+)\.([a-zA-Z]{2,5})$"
        prog = re.compile(pattern)
        result = prog.match(email)

        if not bool(result):
            raise forms.ValidationError(
                "Invalid Email address. Use a valid email address.")

        if len(str(email)) > 60:
            raise forms.ValidationError("Invalid Length")

        return email

    def clean_Password(self):
        password = self.cleaned_data.get("Password")

        if len(str(password)) > 35:
            raise forms.ValidationError("Invalid length of password")

        return password

    def clean_Password_Cnf(self):
        cnf = self.cleaned_data.get("Cnf_Password")

        if len(str(cnf)) > 35:
            raise forms.ValidationError("Invalid length of password")

        return cnf

    def clean(self):
        if 'Password' in self.cleaned_data and 'Cnf_Password' in self.cleaned_data:
            if self.cleaned_data['Password'] != self.cleaned_data[
                    'Cnf_Password']:
                raise forms.ValidationError(
                    "The two password fields did not match.")
        return self.cleaned_data

    def clean_StudentNo(self):

        std = self.cleaned_data.get('StudentNo')
        pattern = '^\d{7}[D]{0,1}$'
        prog = re.compile(pattern)
        result = prog.match(std)

        if StudentInfo.objects.all().filter(student_no=std).exists():
            raise forms.ValidationError(
                "Student Number already exist in data base")

        if not bool(result):
            raise forms.ValidationError("Invalid format of Student number ")
        return std