From e35480d6b7adf76f5bc4d46153b621abd722c681 Mon Sep 17 00:00:00 2001 From: 0livd <0livd@users.noreply.github.com> Date: Wed, 22 Feb 2017 23:40:52 +0100 Subject: Add export feature Bills and transactions can now be exported to json or csv ref #28 --- budget/forms.py | 13 +++++++++++++ 1 file changed, 13 insertions(+) (limited to 'budget/forms.py') diff --git a/budget/forms.py b/budget/forms.py index c2455da..a097abe 100644 --- a/budget/forms.py +++ b/budget/forms.py @@ -174,3 +174,16 @@ class CreateArchiveForm(Form): name = TextField(_("Name for this archive (optional)"), validators=[]) start_date = DateField(_("Start date"), validators=[Required()]) end_date = DateField(_("End date"), validators=[Required()], default=datetime.now) + + +class ExportForm(Form): + export_type = SelectField(_("What do you want to download ?"), + validators=[Required()], + coerce=str, + choices=[("bills", _("bills")), ("transactions", _("transactions"))] + ) + export_format = SelectField(_("Export file format"), + validators=[Required()], + coerce=str, + choices=[("csv", "csv"), ("json", "json")] + ) -- cgit v1.1