Beispiel #1
0
class AddForm(FlaskForm):
    name = StringField('series name', [InputRequired()])
    payer = StringField('payer')
    payer_account = SelectField(label='pay from account',
                                choices=get_accounts_as_list_of_tuples(),
                                default='other')
    payee = StringField('payee')
    payee_account = SelectField(label='pay to account',
                                choices=get_accounts_as_list_of_tuples(),
                                default='other')
    amount = DecimalField('amount', [InputRequired()],
                          places=2,
                          default=0.0,
                          rounding=ROUND_HALF_UP)
    start_date = DateField('start date', [InputRequired()],
                           format='%Y-%m-%d',
                           default=datetime.date.today())
    end_date = DateField('end date', [InputRequired()],
                         format='%Y-%m-%d',
                         default=datetime.date.today())
    frequency = SelectField(label='frequency', choices=get_as_list_of_tuples())
    submit = SubmitField('add')

    def __init__(self, *args, **kwargs):
        super(AddForm, self).__init__(*args, **kwargs)
        self.payer_account.choices = get_accounts_as_list_of_tuples()
        self.payee_account.choices = get_accounts_as_list_of_tuples()
Beispiel #2
0
class AddForm(FlaskForm):
    payer = StringField('payer', [has_payer])
    payer_account = SelectField(label='pay from account',
                                choices=get_accounts_as_list_of_tuples(),
                                default='other')
    payee = StringField('payee', [has_payee])
    payee_account = SelectField(label='pay to account',
                                choices=get_accounts_as_list_of_tuples(),
                                default='other')
    amount = DecimalField('amount', [InputRequired()],
                          places=2,
                          default=0.0,
                          rounding=ROUND_HALF_UP)
    date = DateField('date', [InputRequired()], format='%Y-%m-%d')
    submit = SubmitField('add')

    def __init__(self, *args, **kwargs):
        super(AddForm, self).__init__(*args, **kwargs)
        self.payer_account.choices = get_accounts_as_list_of_tuples()
        self.payee_account.choices = get_accounts_as_list_of_tuples()
Beispiel #3
0
 def __init__(self, *args, **kwargs):
     super(AddForm, self).__init__(*args, **kwargs)
     self.payer_account.choices = get_accounts_as_list_of_tuples()
     self.payee_account.choices = get_accounts_as_list_of_tuples()