question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

Add request.FILES to wagtailforms form creation

See original GitHub issue

I would like to request we add request.FILES to the creation of custom forms.

Reasoning: It makes it much easier to extend the forms with features like file and image uploads, without having to override the whole serve method.

File: wagtail/wagtailforms/models.py Line 240 https://github.com/wagtail/wagtail/blob/master/wagtail/wagtailforms/models.py#L240

Current form = self.get_form(request.POST, page=self, user=request.user)

Suggested form = self.get_form(request.POST, request.FILES, page=self, user=request.user)

I am happy to put through a pull request and check tests against this change, the request.FILES object will be empty when there are no files so it should not affect existing code.

Issue Analytics

  • State:closed
  • Created 6 years ago
  • Comments:8 (6 by maintainers)

github_iconTop GitHub Comments

1reaction
lb-commented, Sep 3, 2017

@BertrandBordage FWIW here is my blog post - slide me an email if you have some thoughts on this implementation. https://posts-by.lb.ee/image-uploads-in-wagtail-forms-3121c9b35d27

1reaction
BertrandBordagecommented, Aug 26, 2017

OK, then I’m fine with merging your pull request.

Read more comments on GitHub >

github_iconTop Results From Across the Web

How can I add an Upload File field to a Wagtail Form?
Hey, I have recently revised the original post about adding image uploads and it works on Wagtail 2.10 - dev.to/lb/image-uploads-in-wagtail- ...
Read more >
How to create file upload forms for your clients (a step-by-step ...
Step 2: build a new form request. In the home screen, select Add New Request. This takes you to the Request Builder screen....
Read more >
Image Uploads in Wagtail Forms - Posts by LB
We are adding request.FILES to the arguments between request.POST and page=self . The detailed reason for this is that Django handles files sent ......
Read more >
Image Uploads in Wagtail Forms - DEV Community ‍ ‍
Adding Image Upload Fields to Forms in Wagtail ... In your models file you will now need to create an extended form builder...
Read more >
how to add file upload field in wagtail form ? - Google Groups
I am trying to make something like simple google forms application in wagtail, as I know that there are almost everything is available...
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found