Skip to content

Instantly share code, notes, and snippets.

@lb-
Created September 3, 2017 12:08
Show Gist options
  • Select an option

  • Save lb-/a3c6b8c0c3f2f0fd2574ed8cc29afd94 to your computer and use it in GitHub Desktop.

Select an option

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,
})
@lb-

lb- commented Aug 23, 2019

Copy link
Copy Markdown
Author

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

@ChiragKanzariya

ChiragKanzariya commented Aug 23, 2019 via email

Copy link
Copy Markdown

@lb-

lb- commented Aug 24, 2019

Copy link
Copy Markdown
Author

@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

ChiragKanzariya commented Aug 24, 2019 via email

Copy link
Copy Markdown

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