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:
|
||||
user = db.get_user(email)
|
||||
letters = db.get_user_letters(user.id)
|
||||
if True: # len(letters) == 0:
|
||||
db.add_letter(user.id, 'LETTER_TITLE', jsonify(data).get_data(True))
|
||||
letter_json = jsonify(data).get_data(True)
|
||||
if len(letters) == 0:
|
||||
db.add_letter(user.id, 'LETTER_TITLE', letter_json)
|
||||
else:
|
||||
print("TODO: Add letter editing!")
|
||||
# db.edit_letter()
|
||||
# TODO: Add letter editing!
|
||||
# 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()
|
||||
if errors:
|
||||
|
|
Loading…
Reference in New Issue