Opened 7 years ago

Closed 7 years ago

#28424 closed Uncategorized (invalid)

TypeError: context must be a dict rather than Context.

Reported by: MaximeK Owned by: nobody
Component: Template system Version: 1.11
Severity: Release blocker Keywords: Context
Cc: Triage Stage: Unreviewed
Has patch: no Needs documentation: no
Needs tests: no Patch needs improvement: no
Easy pickings: no UI/UX: no

Description

Hi,
We have an issue when we include a template.

Here the schema :

page1.html include page2.html with {% include 'page2.html' %}

We add a dict with modelForms into the view :

    profile = Profile.objects.get(pk=profile_id)
    profile_form = ProfileEditForm(instance=profile)
    ticket_form = TicketCreateForm()
    document_form = ProfileDocumentForm(initial={'profile': profile})

and we return a render :

    return render(request, 'page1.html', locals())

We have this error :

context must be a dict rather than Context.
Request Method:	GET
Request URL:	http://localhost:8000/url_path
Django Version:	1.11.3
Exception Type:	TypeError
Exception Value:	
context must be a dict rather than Context.
Exception Location:	/path/env/lib/python2.7/site-packages/django/template/context.py in make_context, line 287
Python Executable:	/path/env/bin/python
Python Version:	2.7.10

What is strange, is we can make it run if we use the fix submitted for this ticket #27722, so for me it's still not fixed :(

Change History (2)

comment:1 by Tim Graham, 7 years ago

Please provide a sample project to reproduce the issue.

comment:2 by MaximeK, 7 years ago

Resolution: invalid
Status: newclosed

My sample have not this issue, it was another 3rd party template plugin that had a bug.
I close the ticket here.

Note: See TracTickets for help on using tickets.
Back to Top