I have this code in context_processors.py
class ContactFormView(FormView):
form_class = ContactForm
template_name = "blog/contact.html"
success_url = "/contact/"
def form_valid(self,form):
contact_name = form.cleaned_data.get('contact_name')
contact_email = form.cleaned_data.get('contact_email')
form_content = form.cleaned_data.get('content','')
try:
send_mail(contact_name,form_content,contact_email,[settings.EMAIL_HOST_USER], fail_silently=False)
except BadHeaderError:
return HttpResponse('Invalid Header Found')
return super(ContactFormView,self).form_valid(form)
I want to include this in all the views by using context processors.I am getting this error:
TypeError at /
__init__() takes exactly 1 argument (2 given)
Request Method: GET
Request URL: http://127.0.0.1:8000/
Django Version: 1.8.7
Exception Type: TypeError
Exception Value:
__init__() takes exactly 1 argument (2 given)
Exception Location: C:\Python27\lib\site-packages\django-1.8.7-py2.7.egg\django\template\context.py in bind_template, line 241
Python Executable: C:\Python27\python.exe
Python Version: 2.7.10
How to pass this form in all the template?