how to add file upload field in wagtail form ?

1,424 views
Skip to first unread message

Ratan Kulshreshtha

unread,
Aug 10, 2016, 12:38:25 PM8/10/16
to Wagtail support
I am trying to make something like simple google forms application in wagtail, as I know that there are almost everything is available in wagtail forms but I also want to add a field to upload images and pdf file just like I can add other fields in the form using admin panel of wagtail.

Please help.

Matthew Westcott

unread,
Aug 11, 2016, 5:54:08 AM8/11/16
to wag...@googlegroups.com
Hi Ratan,

Unfortunately wagtailforms doesn't currently support this - it would need quite a lot of special-case handling, since (for example) you can't simply include a file field in a CSV export.

Generally, when your forms get more complex and become a "programmer task" rather than a content editor task, it's worth considering implementing them using Django forms instead of the wagtailforms module. (It does mean you lose the ability to specify fields through the Wagtail admin, but if they have custom logic attached then defining them in code is a better idea anyhow.) An example of integrating a Django form into Wagtail is here: https://github.com/gasman/wagtail-form-example

Cheers,
- Matt

Ratan Kulshreshtha

unread,
Aug 11, 2016, 7:35:33 AM8/11/16
to Wagtail support
What should I do so that I can make a form that can be added through the wagtail admin with file upload field just like there are fields for abstract form in wagtail admin. I am a newbie and I am trying to implement something like google forms.

Alexandr Melnic

unread,
Apr 1, 2017, 12:38:21 PM4/1/17
to Wagtail support
Hi Matt,

From the example you posted below( wagtail-form-example ). How can I access the content from database, that users have submited trough this Django Form? I mean displaying all this submissions in 'Forms' in Wagtail Admin Sidebar. I hope you will help me with this.

Thanks,
- Alex

четверг, 11 августа 2016 г., 12:54:08 UTC+3 пользователь Matthew Westcott написал:

Matthew Westcott

unread,
Apr 2, 2017, 1:14:20 PM4/2/17
to wag...@googlegroups.com
Hi Alex,

One possibility would be to register the model with ModelAdmin <http://docs.wagtail.io/en/v1.9/reference/contrib/modeladmin/index.html> - although that's not a 100% replacement for the wagtailforms submission view (there's no option to download as CSV, for example).

Cheers,
- Matt

LB

unread,
Sep 3, 2017, 8:49:16 AM9/3/17
to Wagtail support
Hi Ratan,

I know it is has been a while since you posted this, I ran into the same issue in our Wagtail set up and have since solved it for our use case (which is an internal intranet application).

I have detailed the basic version of our implementation here:

Our actual full set up is a bit more complicated as we want to handle how the image is sent via emails and shows up in form submission listings, plus we want extra info added to the image title when created. Nonetheless, I hope this helps you out.
Reply all
Reply to author
Forward
0 new messages