Esempio n. 1
0
class BookingsForm(forms.ModelForm):
    allday = forms.BooleanField(label='Dia inteiro', required=False)
    title = forms.CharField(label='Titulo do agendamento')
    start = forms.DateTimeField(label='Inicia em...')
    end = forms.DateTimeField(label='Termina em...')
    #created_on = forms.DateTimeField(label='Criado em...')
    authorized = forms.BooleanField(label='Autorizado', required=False)
    editable = forms.BooleanField(label='Editavel', required=False)
    # ABAIXO, CHOICES NO FORMS VAI TER UMALISTAGEM NO TEMPLATE
    color = forms.ChoiceField(label='Cor', choices=(('blue', 'blue'),
                                                    ('red', 'red'),
                                                    ('green', 'green'),
                                                    ('black', 'black')))
    overlap = forms.BooleanField(label='Sobrepor?', required=False)
    holiday = forms.BooleanField(label='Feriado?', required=False)
    participants = forms.ModelMultipleChoiceField(label='Participantes', queryset=User.objects.all(), widget=FilteredSelectMultiple("Participantes", is_stacked=False, attrs={'class':'material-ignore', 'multiple':'True'}))

    class Meta:
        model = Booking
        exclude = ['created_on']
        fields = '__all__'

    layout = Layout(
        Fieldset('Inclua uma agenda',
                 Row('title', ),
                 Row('start','end', 'color'),
                 Row(Span6('holiday'),Span6('authorized'), ),
                 Row(Span6('editable'), Span6('allday')),
                 Row('overlap'),
                 Row('participants')
                 )
    )
Esempio n. 2
0
class ContactForm(forms.Form):
    name = forms.CharField(label='Nome')
    email = forms.EmailField(label='E-Mail')
    message = forms.CharField(label='Mensagem', widget=forms.Textarea)

    layout = Layout(
        Fieldset("Fale Conosco",
                 Row(Span6('name'), Span6('email')),
                 Row(Span12('message'))))

    def send_mail(self):
        name = self.cleaned_data['name']
        email = self.cleaned_data['email']
        message = self.cleaned_data['message']
        message = 'Nome: {0}\nE-Mail:{1}\n{2}'.format(name, email, message)
        send_mail('Contato do Elias Cabeção', message, settings.DEFAULT_FROM_EMAIL, [email])

        # msg = MIMEText('Email configurado com sucesso!')
        # msg['Subject'] = "Email enviado pelo python"
        # msg['From']    = "*****@*****.**"
        # msg['To']      = "*****@*****.**"
        #
        # s = smtplib.SMTP('smtp.mailgun.org', 587)
        #
        # s.login('*****@*****.**', 'r3****f9')
        # s.sendmail(msg['From'], msg['To'], msg.as_string())
        # s.quit()
Esempio n. 3
0
class UserAdminCreationForm(UserCreationForm):

    class Meta:
        model = User
        fields = ['username', 'email','image']
    layout = Layout(
        Span6('username'), Span6('email'),
        Row(Span6('password1'), Span6('password2')),
        Span6('image'))
Esempio n. 4
0
class ShareholderForm(forms.ModelForm):
    layout = Layout(
        'bank',
        Fieldset(
            "Shareholders",
            Row(Span4('shareholder'), Span2('share'),
                Span4('ultimate_country_name'), Span2('ultimate_country_id')),
            Row(Span6('category'), Span6('is_ultimate'))))

    class Meta:
        model = Shareholder
        fields = '__all__'
Esempio n. 5
0
class ExecutiveForm(forms.ModelForm):
    gender = forms.ChoiceField(
        choices=Executive.GENDER,
        # label='Bank Category',
        widget=forms.RadioSelect)
    layout = Layout(
        Row(Span6('bank'), Span6('period')),
        Fieldset("Bank Executives",
                 Row(Span6('name'), Span2('gender'), Span4('photo')),
                 Row(Span6('title'), Span6('report_to')), 'is_current'))

    class Meta:
        model = Executive
        fields = '__all__'
Esempio n. 6
0
class IndicatorForm(forms.ModelForm):
    pbt = forms.CharField()
    funding = forms.CharField()
    lending = forms.CharField()
    asset = forms.CharField()
    headcount = forms.CharField()
    layout = Layout(
        Row(Span6('bank'), Span6('period')),
        Fieldset("Bank Indicators", Row('pbt', 'asset', 'funding', 'lending'),
                 Row(Span6('is_current'), Span6('headcount'))))

    class Meta:
        model = Indicator
        fields = '__all__'

    def clean_name(self):
        # custom validation for the name field
        pass
Esempio n. 7
0
class SignupForm(forms.ModelForm):
    password1 = forms.CharField(label = 'Password', widget = forms.PasswordInput)
    password2 = forms.CharField(label = 'Confirm Password', widget = forms.PasswordInput, help_text = 'Should be same as Password')
    layout = Layout(
        Row(Span6('first_name'), Span6('last_name')),
        Row('username'),
        Row('email'),
        Row(Span6('password1'), Span6('password2')),
    )

    def __init__(self, *args, **kwargs):
        super(SignupForm, self).__init__(*args, **kwargs)
        self.fields['email'].required = True

    def clean_password2(self):
        data_password1 = self.cleaned_data.get('password1')
        data_password2 = self.cleaned_data.get('password2')

        if data_password1 and data_password2 and data_password1 != data_password2:
            raise forms.ValidationError('Passwords don\'t match')
        if len(data_password2) < 6:
            raise forms.ValidationError('Password is too short (minimum is 6 characters) ')

        return data_password2

    def save(self, commit = True):
        user = super(SignupForm, self).save(commit = False)
        user.set_password(self.cleaned_data.get('password1'))
        user.is_active = False
        if commit == True:
            user.save()
        return user

    class Meta:
        model = CustomUser
        fields = ['first_name', 'last_name', 'username', 'email']
Esempio n. 8
0
class PersonForm(forms.ModelForm):
    related_person = forms.ModelMultipleChoiceField(label='Pessoa Relacionada',
                                                    required=False,
                                                    queryset=Person.objects.all().order_by('name'),
                                                    )

    class Meta:
        model = Person
        fields = (
            'name',
            'name_fantasy',
            'phone',
            'cpf_cnpj',
            'email',
            'nascimento',
            'rg',
            'cep',
            'logradouro',
            'complemento',
            'numero',
            'bairro',
            'cidade',
            'estado',
            'category_person',
            'related_person',

        )
        exclude = ('priority', 'nascimento')

    layout = Layout(
        Fieldset("Pessoa",
                 Row(Span8('name'), Span4('name_fantasy'), ),
                 Row(Span4('phone'), Span4('cpf_cnpj'), Span4('rg')),
                 Row(Span12('email'), ),
                 ),

        Fieldset("Categorias da Pessoa",
                 Row(Span12('category_person'),)
                 ),

        Fieldset("Pessoa Relacionada",
                 Row(Span12('related_person'), )
                 ),

        Fieldset('Endereço',
                 Row(Span2('cep'), Span6('logradouro'), Span2('complemento'), Span2('numero')),
                 Row(Span5('bairro'), Span5('cidade'), Span2('estado')))
        )
Esempio n. 9
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"