2017-01-09 7 views
1

私は、郵便配達員を使用してフラスコ内でwtformを使用して作成したフォームをテストしようとしています。私はStringFieldsのフィールドリストを持っており、私はminumumエントリ= 2を指定しました。私は郵便配達員からの検証をテストするためにさまざまなソリューションを試しましたが、常に検証は失敗します。フィールドリストを削除してテストを試みましたが、フォームの検証が正しく機能しています。私はx-www-form-urlencodedのkeyvalue形式の郵便配達郵便からの郵便番号のリストとしてデータを送ることができません。 コードスニペット:FieldList of StringFieldの郵便配達からフラスコへの送信

class PostUserForm(Form): 
    email = StringField('email', [validators.DataRequired()]) 
    name = StringField('name', [validators.DataRequired()]) 
    words = FieldList(StringField('words',[validators.DataRequired()]), min_entries=2) 


@apiV1.route('/user', methods=['POST']) 
def post_user(): 
    form = PostUserForm(request.form) 
    print request.form 
    if form.validate(): 
     return jsonify("correct data"), 200 
    else: 
     return jsonify(form.errors), 400 

以下は、私が試したソリューションです: enter image description hereenter image description hereenter image description hereenter image description here出力:Output same for all solutions

+0

検証エラーを示して、それを行う方法を見つけましたあなたはいますか? – MrLeeh

+0

出力スクリーンショットは、検証エラーを示しています –

答えて

0

は最後にスクリーンショットを以下はサンプル要求enter image description here

関連する問題