Don't create a new letter every time.
This commit is contained in:
parent
2807c72740
commit
98e385376c
|
@ -184,11 +184,14 @@ def index_post():
|
||||||
if email:
|
if email:
|
||||||
user = db.get_user(email)
|
user = db.get_user(email)
|
||||||
letters = db.get_user_letters(user.id)
|
letters = db.get_user_letters(user.id)
|
||||||
if True: # len(letters) == 0:
|
letter_json = jsonify(data).get_data(True)
|
||||||
db.add_letter(user.id, 'LETTER_TITLE', jsonify(data).get_data(True))
|
if len(letters) == 0:
|
||||||
|
db.add_letter(user.id, 'LETTER_TITLE', letter_json)
|
||||||
else:
|
else:
|
||||||
print("TODO: Add letter editing!")
|
# TODO: Add letter editing!
|
||||||
# db.edit_letter()
|
# For now, edit just the one existing letter
|
||||||
|
letter = letters[0]
|
||||||
|
db.edit_letter(letter.id, letter.title, letter_json)
|
||||||
|
|
||||||
(resp, errors) = data.generate_pdf()
|
(resp, errors) = data.generate_pdf()
|
||||||
if errors:
|
if errors:
|
||||||
|
|
Loading…
Reference in New Issue