Created
September 3, 2017 12:08
-
-
Save lb-/a3c6b8c0c3f2f0fd2574ed8cc29afd94 to your computer and use it in GitHub Desktop.
Wagtail Forms - Upload Image Field - Extend FormBuilder Class
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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
commented
Aug 12, 2019
via email
I need serve and process method code changes.
On Mon, 12 Aug, 2019, 2:30 PM Chirag Kanzariya, <
chirag1998kanzariya@gmail.com> wrote:
… Thank you for the update but can you send me file upload latest version
code.
On Sun, 4 Aug, 2019, 12:11 PM LB (Ben Johnston), ***@***.***>
wrote:
> @ChiragKanzariya <https://github.com/ChiragKanzariya> - the internal set
> up of FormBuilder has changed somewhat since this was written.
> But the source code for that class can be seen here:
>
> https://github.com/wagtail/wagtail/blob/master/wagtail/contrib/forms/forms.py#L103
>
> Note that FIELD_TYPES is no longer a static attribute on FormBuilder but
> instead there is a property called formfields which could be overridden
> to add the 'image' type field.
>
> I have not really had the chance to update/re-write the blog post with
> the new internal workings in mind, but hope that helps.
>
> —
> You are receiving this because you were mentioned.
> Reply to this email directly, view it on GitHub
> <https://gist.github.com/a3c6b8c0c3f2f0fd2574ed8cc29afd94?email_source=notifications&email_token=ALGRQZF5TGWIP4M6743RS5TQCZ2YXA5CNFSM4IGMVMC2YY3PNVWWK3TUL52HS4DFVNDWS43UINXW23LFNZ2KUY3PNVWWK3TUL5UWJTQAFWOOG#gistcomment-2989283>,
> or mute the thread
> <https://github.com/notifications/unsubscribe-auth/ALGRQZBPERXM75HSLNPZ6LDQCZ2YXANCNFSM4IGMVMCQ>
> .
>
Hi @ChiragKanzariya - I don't have an updated example sorry but you can view all the Wagtail source code on their repo.
Ok thank you I got it how to do it
…On Fri, 23 Aug, 2019, 12:56 PM LB (Ben Johnston), ***@***.***> wrote:
Hi @ChiragKanzariya <https://github.com/ChiragKanzariya> - I don't have
an updated example sorry but you can view all the Wagtail source code on
their repo.
—
You are receiving this because you were mentioned.
Reply to this email directly, view it on GitHub
<https://gist.github.com/a3c6b8c0c3f2f0fd2574ed8cc29afd94?email_source=notifications&email_token=ALGRQZB6CRVDC6JKIFRLWG3QF6GJ3A5CNFSM4IGMVMC2YY3PNVWWK3TUL52HS4DFVNDWS43UINXW23LFNZ2KUY3PNVWWK3TUL5UWJTQAFXPLA#gistcomment-3006128>,
or mute the thread
<https://github.com/notifications/unsubscribe-auth/ALGRQZD7GIN6BRMPRPBHYULQF6GJ3ANCNFSM4IGMVMCQ>
.
@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.
Write now I am in vacation so i will do it on Monday.
…On Sat, 24 Aug, 2019, 7:14 AM LB (Ben Johnston), ***@***.***> wrote:
@ChiragKanzariya <https://github.com/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.
—
You are receiving this because you were mentioned.
Reply to this email directly, view it on GitHub
<https://gist.github.com/a3c6b8c0c3f2f0fd2574ed8cc29afd94?email_source=notifications&email_token=ALGRQZC2TGPCFDRR3JMWPQLQGCG7ZA5CNFSM4IGMVMC2YY3PNVWWK3TUL52HS4DFVNDWS43UINXW23LFNZ2KUY3PNVWWK3TUL5UWJTQAFXQXA#gistcomment-3006832>,
or mute the thread
<https://github.com/notifications/unsubscribe-auth/ALGRQZCV5JRY3QE3HOLBGPTQGCG7ZANCNFSM4IGMVMCQ>
.
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment