Opened 5 years ago

Closed 5 years ago

Last modified 5 years ago

#28125 closed Cleanup/optimization (fixed)

Clarify 1.11 release notes about which Template class prohibits non-dict contexts

Reported by: Eddie Bragg Owned by: Tim Graham
Component: Documentation Version: 1.11
Severity: Normal Keywords:
Cc: Triage Stage: Accepted
Has patch: yes Needs documentation: no
Needs tests: no Patch needs improvement: no
Easy pickings: no UI/UX: no

Description (last modified by Tim Graham)

According to the release docs for 1.11 any call to render() on a Template object you need to pass a dict
https://docs.djangoproject.com/en/1.11/releases/1.11/#django-template-render-prohibits-non-dict-context

I have code that originally passes a Context object.
Upgrading to 1.11 from 1.10 and changing it to a dict causes this error 'dict' object has no attribute 'render_context'

Looking at Django code the error occurs at https://github.com/django/django/blob/1.11/django/template/base.py#L203
I believe this code still expects a Context object.

Change History (4)

comment:1 Changed 5 years ago by Tim Graham

Component: Template systemDocumentation
Description: modified (diff)
Owner: changed from nobody to Tim Graham
Status: newassigned
Summary: Calling render on a Template object passing a dict failsClarify 1.11 release notes about which Template class prohibits non-dict contexts
Type: BugCleanup/optimization

This is a confusion between django.template.backends.django.Template, which the release notes are meant to refer to, and django.template.base.Template. I'll clarify the release notes.

comment:2 Changed 5 years ago by Tim Graham

Has patch: set
Triage Stage: UnreviewedAccepted

comment:3 Changed 5 years ago by GitHub <noreply@…>

Resolution: fixed
Status: assignedclosed

In bce5cc57:

Fixed #28125 -- Clarified 1.11 release note about Template.render() prohibiting non-dict context.

comment:4 Changed 5 years ago by Tim Graham <timograham@…>

In 5ac322dd:

[1.11.x] Fixed #28125 -- Clarified 1.11 release note about Template.render() prohibiting non-dict context.

Backport of bce5cc57e915914708f9cd4c8bd6bbc6a68195d4 from master

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