Python Daily
2.57K subscribers
1.48K photos
53 videos
2 files
38.9K links
Daily Python News
Question, Tips and Tricks, Best Practices on Python Programming Language
Find more reddit channels over at @r_channels
Download Telegram
[AF] My form data is showing up in the textarea <wrapped in brackets like this> and I don't know how to resolve

Hi all,

Obviously I'm new at this. I have a form. I send it data like so via the route:

@app.route('/edit_log/<postId>', methods=['GET', 'POST'])
@login_required
def edit_log(postId):

#get the data from the database to show in the form
postData = Post.query.filter_by(id=postId).first()


form = EditPostForm()
if form.validate_on_submit():
post = Post(body=form.post.data, author=current_user)
db.session.commit()
flash('Your changes have been saved.')
return redirect(url_for('org'))
elif request.method == 'GET':
#fill the form data with the actual post info from the above query
form.post.data = postData
return

/r/flask
https://redd.it/a7ivpg