Hello Ben,
most of the functionality of the wagtail form builder can be found on
wagtail/wagtailforms/{forms, models}.py. In forms.py you'll find a
FormBuilder object (not related to other wagtail classes) that can be
initialized with an array of fields and return a normal django Form.
Each field in that array of fields is just an instance of an
AbstractFormField (found in models.py) that has some specific
attributes like label, field_type, required etc. This
AbstractFormField does actually need wagtail because it inherits from
Orderable (to allow it to be ordered in the wagtail editor) but you
can instead just inherit from models.Model.
So, each of your dynamic forms should contain an array of
AbstractFormFields (you'll need *another* form through which you'll
create these fields) and, when you want to display it you'll pass that
array of fields to the FormBuilder and you'll get back your form to
put in your view.
Also, before a couple of years I had written an article that should
explain these concepts some more:
https://spapas.github.io/2013/12/24/django-dynamic-forms/. In there I
had a JSON string as a source of the dynamic form (I hadn't create a
normal form for creating the dynamic form, instead I just allowed the
editors to edit the JSON directly through the /admin) -- but that JSON
could instead be database fields like in wagtail.
Best regards,
Serafeim
> --
> You received this message because you are subscribed to the Google Groups
> "Wagtail support" group.
> To unsubscribe from this group and stop receiving emails from it, send an
> email to
wagtail+u...@googlegroups.com.
> To post to this group, send email to
wag...@googlegroups.com.
> Visit this group at
https://groups.google.com/group/wagtail.
> To view this discussion on the web, visit
>
https://groups.google.com/d/msgid/wagtail/a9f45a4a-e76f-4c07-9f63-a2194a691a86%40googlegroups.com.
> For more options, visit
https://groups.google.com/d/optout.