I want to add a contact form in my homepage in a mezzanine project. Homepage inherits from Page class and is loaded perfectly using the mezzanine project.
I created a new generic view in my project and I bound urls.py to it.
class Home(FormView):
template_name = "index.html"
form_class = ContactForm
success_url = '/'
def get_context_data(self, **kwargs):
page = Page.objects.get(title='Home')
return {
'page': page,
'params': kwargs,
}
If if load the page in a terminal, using django.test.client, I found exactly what I want in my homepage which is in page.homepage.
But the template index.html
is not loaded at all. I only get the base.html
. So variables based on {{ page }}
are not found. index.html
seems to be ignored.
Could you help me to find out what's going wrong there? How, for example, can I test the template index?