My goal is to include a form on specific page that is not a Form page.
Thanks to the documentation, I've learned that page_processors seem to be
the way to go, but I'm trying to wrap my head around how page_processors.py
is implemented and I think I'm missing something obvious. Any help would be
appreciated.
Here's what I have:
My app is site and page_processors.py is placed inside it like so:
site/
page_processors.py
page_processors.py:
from django import forms
from django.http import HttpResponseRedirect
from mezzanine.pages.page_processors import processor_for
from mezzanine_events.models import Event
class EventForm(forms.Form):
name = forms.CharField()
email = forms.EmailField()
@processor_for("about/events/test-event-3")
print "processor"
def event_form(request, page):
form = EventForm()
if request.method == "POST":
form = EventForm(request.POST)
if form.is_valid():
# Form processing goes here.
redirect = request.path + "?submitted=true"
return HttpResponseRedirect(redirect)
return {"form": form}
Now what? I assume that I can use a template tag for "form", but I haven't
been successful in any iteration of that.
Thanks in advance!
Sep
--
You received this message because you are subscribed to the Google Groups
"Mezzanine Users" group.
To unsubscribe from this group and stop receiving emails from it, send an email
to [email protected].
For more options, visit https://groups.google.com/d/optout.