Skip to content

Instantly share code, notes, and snippets.

@lb-
Created September 3, 2017 12:08
Show Gist options
  • Save lb-/a3c6b8c0c3f2f0fd2574ed8cc29afd94 to your computer and use it in GitHub Desktop.
Save lb-/a3c6b8c0c3f2f0fd2574ed8cc29afd94 to your computer and use it in GitHub Desktop.
Wagtail Forms - Upload Image Field - Extend FormBuilder Class
from wagtail.wagtailforms.forms import FormBuilder
from wagtail.wagtailimages.fields import WagtailImageField
class ExtendedFormBuilder(FormBuilder):
def create_image_upload_field(self, field, options):
return WagtailImageField(**options)
FIELD_TYPES = FormBuilder.FIELD_TYPES
FIELD_TYPES.update({
'image': create_image_upload_field,
})
@ChiragKanzariya
Copy link

ChiragKanzariya commented Aug 12, 2019 via email

@ChiragKanzariya
Copy link

ChiragKanzariya commented Aug 12, 2019 via email

@lb-
Copy link
Author

lb- commented Aug 23, 2019

Hi @ChiragKanzariya - I don't have an updated example sorry but you can view all the Wagtail source code on their repo.

@ChiragKanzariya
Copy link

ChiragKanzariya commented Aug 23, 2019 via email

@lb-
Copy link
Author

lb- commented Aug 24, 2019

@ChiragKanzariya - awesome, if you don't mind, can you share the repo (if on github) or paste the relevant part of your code here.

This will help me and others work through this in the future, plus helps me if I get the time to write a new blog post about this.

@ChiragKanzariya
Copy link

ChiragKanzariya commented Aug 24, 2019 via email

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment