Exemplo n.º 1
0
class TransactionCreateForm(Form):
    description = TextField(u"Beschreibung", validators=[DataRequired()])
    valid_on = DateField(u"Gültig ab",
                         validators=[Optional()],
                         today_btn=True,
                         today_highlight=True,
                         default=datetime.date.today())
    splits = FieldList(FormField(SplitCreateForm),
                       validators=[DataRequired()],
                       min_entries=2)

    def validate_splits(self, field):
        balance = sum(split_form['amount'].data for split_form in field
                      if split_form['amount'].data is not None)
        if balance != 0:
            raise ValidationError(u"Buchung ist nicht ausgeglichen.")
Exemplo n.º 2
0
class UserSuspendForm(Form):
    ends_at = FormField(OptionallyUnlimitedEndDateForm)
    reason = TextAreaField(u"Grund", [DataRequired()])
    violation = BooleanField("Verstoß")
Exemplo n.º 3
0
class UserEditGroupMembership(Form):
    begins_at = DateField(u"Beginn", [DataRequired()])
    ends_at = FormField(OptionallyUnlimitedEndDateForm)
Exemplo n.º 4
0
class UserAddGroupMembership(Form):
    group = QuerySelectField(u"Gruppe", get_label='name',
                             query_factory=group_query)
    begins_at = FormField(OptionallyDirectBeginDateForm)
    ends_at = FormField(OptionallyUnlimitedEndDateForm)