Using @processor_for with a Form in Mezzanine

201 views Asked by At

I've built a Form Page in the admin of my Mezzanine project, but I'd like to populate a couple of the fields automatically, depending on where the click to the form has come from: it's a "feedback" form and I'd like to automatically add the ID of the object that the user is providing feedback on to a hidden field in the form.

I've copied the template code from mezzanine/forms/templates/pages/form.html to a custom template and it receives the dictionary I pass it from my view, but I can't work out to pass it my the form I want rendered. The @processor_for function receives request and page... but where's the form? What should I be passing to my template to render the form?

1

There are 1 answers

0
Ryne Everett On

You can use the template tag fields_for:

{% load mezzanine_tags %}

{% errors_for some_form_object %}
<form method="POST">
    {% fields_for some_form_object %}
    <input type="submit">
</form>