edit_form: save file with generated filename

edit date + full member name
This commit is contained in:
David Kilias 2020-03-10 16:11:51 +01:00
parent a76bff6a33
commit 5b2f6c4c7d

View file

@ -3,6 +3,7 @@
import npyscreen import npyscreen
import json import json
from datetime import date
from sys import argv from sys import argv
@ -74,7 +75,8 @@ def main(*_args):
new_data['stammdaten'] = dict(zip(app.sd2.keys(), map(lambda f: f.value, app.sd2.values()))) new_data['stammdaten'] = dict(zip(app.sd2.keys(), map(lambda f: f.value, app.sd2.values())))
new_data['finanzdaten'] = dict(zip(app.fin2.keys(), map(lambda f: f.value, app.fin2.values()))) new_data['finanzdaten'] = dict(zip(app.fin2.keys(), map(lambda f: f.value, app.fin2.values())))
new_data['mitgliederdaten'] = dict(zip(app.mem2.keys(), map(lambda f: f.value, app.mem2.values()))) new_data['mitgliederdaten'] = dict(zip(app.mem2.keys(), map(lambda f: f.value, app.mem2.values())))
with open('foo.json', 'w') as outfile: outfile_name = '{}_{}.json'.format(date.today().isoformat(), '_'.join(new_data['stammdaten']['fullname'].split()))
with open(outfile_name, 'w') as outfile:
json.dump(new_data, outfile, sort_keys=True, indent=4) json.dump(new_data, outfile, sort_keys=True, indent=4)