python flask ImmutableMultiDict

后端 未结 2 1558
醉话见心
醉话见心 2021-02-01 04:28

This is my code:

@user_bp.route(\'/band\', methods=[\'GET\', \'POST\'])
def band_details():
    from include.form.User import Banddetails
    form = Banddetails         


        
相关标签:
2条回答
  • 2021-02-01 04:52

    you can also do the following:

    d = request.form.to_dict()
    

    source: https://tedboy.github.io/flask/generated/generated/werkzeug.ImmutableMultiDict.html

    0 讨论(0)
  • 2021-02-01 04:59

    If you are using an HTTP POST method you need to retrieve parameters like this:

     pippo =  request.form.getlist('name[]')
    

    If you use HTTP GET method, do it like this:

     pippo =  request.args.getlist('name[]')
    

    Check the docs here.

    0 讨论(0)
提交回复
热议问题