|
|
@ -306,13 +306,16 @@ def remove_stack_by_id(id): |
|
|
|
@app.route('/stacks/<int:id>/edit', methods=['POST', 'GET']) |
|
|
|
def edit_stack_by_id(id): |
|
|
|
stack = Stack.query.filter_by(id=id).first() |
|
|
|
form = EditStackForm() |
|
|
|
form = EditStackForm(edit_stack_name = stack.stack_name, edit_stack_description = stack.stack_description) |
|
|
|
|
|
|
|
if request.method == 'POST': |
|
|
|
if form.validate_on_submit(): |
|
|
|
stack_name = form.edit_stack_name.data |
|
|
|
stack_description = form.edit_stack_description.data |
|
|
|
stack.stack_name = stack_name |
|
|
|
stack.stack_description = stack_description |
|
|
|
db.session.commit() |
|
|
|
|
|
|
|
return redirect(url_for('show_stack_by_id', id=id)) |
|
|
|
return render_template('edit_stack_detail.html', stack=stack, form=form) |
|
|
|
## search |
|
|
|