Try to pull form filling from database, where possible.
This commit is contained in:
parent
88bfdb7530
commit
8fbaf6e369
|
@ -1,5 +1,6 @@
|
|||
# Copyright Sage Vaillancourt 2021
|
||||
|
||||
import json
|
||||
import os
|
||||
import subprocess
|
||||
import threading
|
||||
|
@ -89,6 +90,22 @@ def logout():
|
|||
|
||||
@writing_blueprint.route('/', methods=['GET'])
|
||||
def index_get():
|
||||
email = session.get('username')
|
||||
form = CLForm()
|
||||
if email:
|
||||
user = db.get_user(email)
|
||||
letters = db.get_user_letters(user.id)
|
||||
if len(letters) > 0:
|
||||
data = json.load(letters[0].contents)
|
||||
# TODO: Load this data more dynamically
|
||||
form.company.data = data['company']
|
||||
form.body.data = data['body']
|
||||
form.closingText.data = data['closingText']
|
||||
form.jobAndPronoun.data = data['jobAndPronoun']
|
||||
form.mySkills.data = data['mySkills']
|
||||
form.skillTypes.data = data['skillTypes']
|
||||
form.username.data = data['uesrname']
|
||||
|
||||
return render_template(
|
||||
'writing.jinja2',
|
||||
form=CLForm(),
|
||||
|
|
Loading…
Reference in New Issue