1👍
✅
This is because you are not sending the form in the context:
def index(request):
mainc = Data.objects.all()
template = loader.get_template('report/index.html')
context = RequestContext(request, {
'mainc': mainc,
'form' : ContactForm()
})
return HttpResponse(template.render(context))
Consider using render()
instead of HttpResponse
Also, from the code you have shown, there is an issue with def contact():
method too, I am assuming you have not posted the whole code.
Source:stackexchange.com