Fix a few form-data bugs.

This commit is contained in:
Sage Vaillancourt 2022-09-24 21:59:38 +00:00
parent 8fbaf6e369
commit d8a4fa9bba
1 changed files with 4 additions and 3 deletions

View File

@ -96,19 +96,20 @@ def index_get():
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 len(letters) > 0: if len(letters) > 0:
data = json.load(letters[0].contents)
# TODO: Load this data more dynamically # TODO: Load this data more dynamically
data = json.loads(letters[0].contents)
form.company.data = data['company'] form.company.data = data['company']
form.body.data = data['body'] form.body.data = data['body']
form.closingText.data = data['closingText'] form.closingText.data = data['closingText']
form.jobAndPronoun.data = data['jobAndPronoun'] form.jobAndPronoun.data = data['jobAndPronoun']
form.mySkills.data = data['mySkills'] form.mySkills.data = data['mySkills']
form.skillTypes.data = data['skillTypes'] form.skillTypes.data = data['skillTypes']
form.username.data = data['uesrname'] form.username.data = data['username']
return render_template( return render_template(
'writing.jinja2', 'writing.jinja2',
form=CLForm(), form=form,
username=session.get('username') username=session.get('username')
) )