I have a html form and on post, I can pass the form into mongodb
if request.method == 'POST':
new_employee.insert_one(request.form.to_dict())
This works... But how would you append additional string when form is post
for example
if request.method == 'POST':
employee_username = (request.form['employee_first_name'] + '.' + request.form['employee_last_name'])
new_employee.insert_one(request.form.to_dict())
How would you append for example 'employee_username' : employee_username
Try this below :
if request.method == 'POST':
post_data = request.form.to_dict()
employee_username = (request.form['employee_first_name'] + '.' + request.form['employee_last_name'])
post_data['employee_username'] = employee_username
new_employee.insert_one(post_data)
The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.