diff options
Diffstat (limited to '')
-rw-r--r-- | app/views/expenses.py | 22 |
1 files changed, 11 insertions, 11 deletions
diff --git a/app/views/expenses.py b/app/views/expenses.py index 30a6830..c504881 100644 --- a/app/views/expenses.py +++ b/app/views/expenses.py @@ -19,17 +19,17 @@ mod = Blueprint('expenses', __name__) # Form # class ExpenseForm(F.Form): - date = F.DateField(u'Datum', F.req, + date = F.DateField('Datum', F.req, format="%d.%m.%Y", default=lambda: today()) - expense = F.DecimalField(u'Betrag', F.req, - description=u'EUR', + expense = F.DecimalField('Betrag', F.req, + description='EUR', places=2) - description = F.StringField(u'Beschreibung') + description = F.StringField('Beschreibung') - category = F.QuerySelectField(u'Kategorie', + category = F.QuerySelectField('Kategorie', get_label='name') def __init__(self, obj = None, description_req = True): @@ -76,7 +76,7 @@ def calc_month_and_pie(year, month): def entry_flash(msg, exp): """When changing/adding an entry, a message is shown.""" url = url_for('.edit', id = exp.id) - link = u"<a href=\"%s\">%s</a>" % (url, exp.description) + link = "<a href=\"%s\">%s</a>" % (url, exp.description) flash(Markup(msg % link)) # @@ -153,7 +153,7 @@ def edit(id): return { 'form': form } db.session.commit() - entry_flash(u"Eintrag %s geändert.", exp) + entry_flash("Eintrag %s geändert.", exp) return redirect('index') return { 'form': form } @@ -178,7 +178,7 @@ def add(): db.session.add(exp) db.session.commit() - entry_flash(u"Neuer Eintrag %s hinzugefügt.", exp) + entry_flash("Neuer Eintrag %s hinzugefügt.", exp) return redirect('.add') @@ -191,11 +191,11 @@ def search(): try: query = request.form['search'].strip() except KeyError: - flash(u"Ungültige Suchanfrage") + flash("Ungültige Suchanfrage") return redirect('index') if not query: - flash(u"Leere Suche") + flash("Leere Suche") return redirect('index') exps = SingleExpense.of(current_user).filter(SingleExpense.description.ilike(query))\ @@ -203,7 +203,7 @@ def search(): .all() if not exps: - flash(u"Keine Ergebnisse") + flash("Keine Ergebnisse") return redirect('index') return { 'exps': exps } |