mardi 2 janvier 2018

Flask issue with two forms and checkboxes

I am trying to create a form which will be used for marking comments to delete -using checkboxes. Here's a template

<form action = "" method='post'>
        
        
      </form>

Here is a function:

@app.route('/delete_comment', methods=['GET','POST'])
@login_required
@admin_required
def delete_comment():
    form_delete = DeleteCommentForm()
    if form_delete.do.data:
        if request.method == 'POST':
            comments = request.form.getlist('delete')
            print(comments)
   return redirect(url_for('index')

)

Right know I am trying to at least get a list of values of checkboxes to determine whether it is working.

If anyone of you have an idea what is not working, please help :)




Aucun commentaire:

Enregistrer un commentaire