I want to make File Upload a possible Wagtail Form field type on form pages. How do I configure the models to make this possible? Please note I am more interested in allowing users to upload document files like PDFs rather than images.
相关问题
- Laravel Option Select - Default Issue
- Django __str__ returned non-string (type NoneType)
- HTML form is not sending $_POST values
- How to use Control.FromHandle?
- Django & Amazon SES SMTP. Cannot send email
相关文章
- Profiling Django with PyCharm
- Why doesn't Django enforce my unique_together
- MultiValueDictKeyError in Django admin
- Django/Heroku: FATAL: too many connections for rol
- Show a different value from an input that what wil
- Django is sooo slow? errno 32 broken pipe? dcramer
- How can I detect/watch “dirty-status” of an angula
- Why form submit opens new window/tab?
Here is a great article from LB Johnson on that matter. The code below is directly taken from the article (but copying here in case the article goes away), however you might want to follow the article as it explains everything step by step.
It's quite involved at the moment, you'll need to:
AbstractFormField
to define a new field type.FormBuilder
to deal with the new field type.form_builder
to your customFormBuilder
class on your FormPage .serve
method on the FormPage to pass the file data to the form (only if you use Wagtail 1.12 and below as it does it automatically from Wagtail 1.13)process_form_submission
to process the fileHere is the full code:
Here is the (untested) code to handle a document instead of an image:
Now there are some changes made by wagtail developer in FormBuilder So in Below given code is not working now
Instead of this they made
Wagtail Core developer changed FormBuilder.FIELD_TYPES property to FormBuilder.formfields
So i hope this is helpful for developer to let you know which changes happened recently.