2👍
✅
Add form
to extra_context
dic, not context
.
The error is literally saying, context['form']
is invalid, so it’s a good place to start wondering if RequestContext should be used in that fashion.
RequestContext docs: http://docs.djangoproject.com/en/dev/ref/templates/api/#django.template.RequestContext
else:
form = EmailChangeForm(username=request.user.username)
extra_context['form'] = form
context = RequestContext(request, extra_context)
Source:stackexchange.com