0

I did not found any answer to this. So is there a way in Wagtail to have an AbstractEmailForm without AbstractFormField (for example, can I hard code them into AbstractEmailForm? I know that AbstractEmailField has some variables that Django requires). I just need to have a contact form only with email field, I dont need to set fields dynamically.

And the second question: How do I set permission for that form page so that only superuser can edit the form page?(And the translated version too? There are a lot of answers to this, but I don't actually understand how to do it with AbstractEmailForm).

Thanks a lot!

itekhi
  • 151
  • 1
  • 11

1 Answers1

1

If you're hard-coding your form fields, then the Wagtail forms module doesn't really give you anything that you don't already get from Django's forms framework, and so you're better off using Django forms directly. The serve method on a Wagtail page is equivalent to a Django view function, so any form-processing logic that would normally go into a view function can be placed in serve.

There's an example of this here (but written for Wagtail 1.x, so imports will need adjusting): https://github.com/gasman/wagtail-form-example/commits/master

gasman
  • 23,691
  • 1
  • 38
  • 56
  • thanks for your answer! I want to use Wagtail forms ModelAdmin panel to export as CSV and other. Can I somehow combine Django forms and Wagtail's FORMS panel(with CSV export)? – itekhi Nov 27 '20 at 16:19