librelist archives

« back to archive

can append_entry FieldList in Flask-wtf

can append_entry FieldList in Flask-wtf

From:
Mohamad Efazati
Date:
2011-12-17 @ 05:53
Hi
I have form with flask-wtf for upload some image, also file field can be
multiple

> *my form:*
> class ComposeForm(Form):
>     attachment = FieldList(FileField(_('file')), _('attachment'))
>     add_upload = SubmitField(_('Add upload'))
>
> * my view:*
>    if form.validate_on_submit():
>         if form.add_upload.data:
>             form.attachment.append_entry()
>             return render_template('mailbox/compose.html', form=form)
>         else:
>             form.attachment.append_entry()
>
>

> *my template :*
> 	<form method="POST" enctype="multipart/form-data" action=".">
> 			{% for field in form %}
> 			{{field}}
> 			{% endfor %}
> 	</div>
>
>

when i use enctype="multipart/form-data"  in form append_entry dosent work
how i can fix this?