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
|
# Copyright Sage Vaillancourt 2021
|
||||||
|
|
||||||
|
import json
|
||||||
import os
|
import os
|
||||||
import subprocess
|
import subprocess
|
||||||
import threading
|
import threading
|
||||||
|
@ -89,6 +90,22 @@ def logout():
|
||||||
|
|
||||||
@writing_blueprint.route('/', methods=['GET'])
|
@writing_blueprint.route('/', methods=['GET'])
|
||||||
def index_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(
|
return render_template(
|
||||||
'writing.jinja2',
|
'writing.jinja2',
|
||||||
form=CLForm(),
|
form=CLForm(),
|
||||||
|
|
Loading…
Reference in New Issue