[Django] #29639: Fault in the documentation around usage of Context versus dict

13 views
Skip to first unread message

Django

unread,
Aug 5, 2018, 5:56:14 PM8/5/18
to django-...@googlegroups.com
#29639: Fault in the documentation around usage of Context versus dict
-------------------------------------+-------------------------------------
Reporter: | Owner: nobody
JeroenPeterBos |
Type: Bug | Status: new
Component: | Version: 2.1
Documentation |
Severity: Normal | Keywords: Deprecated Usage
Triage Stage: | Has patch: 0
Unreviewed |
Needs documentation: 0 | Needs tests: 0
Patch needs improvement: 0 | Easy pickings: 0
UI/UX: 0 |
-------------------------------------+-------------------------------------
**Problem**
In the documentation on the following page there is a mistake:
[https://docs.djangoproject.com/en/2.1/ref/templates/api/#django.template.Template.render]

Under ''Rendering a context'' -> ''Template.render(context)'' it is
demonstrated how to render a context onto a template.
However doing this results in the error: ''TypeError: context must be a
dict rather than Context.''

I have found that this usage of the ''Context'' class is deprecated in
Django 1.10+.

**Solution**
The documentation regarding ''Rendering a Context'' should be updated to
insert a dictionary instead of first creating a Context and passing that
to the ''render'' function.

--
Ticket URL: <https://code.djangoproject.com/ticket/29639>
Django <https://code.djangoproject.com/>
The Web framework for perfectionists with deadlines.

Django

unread,
Aug 5, 2018, 8:26:45 PM8/5/18
to django-...@googlegroups.com
#29639: Fault in the documentation around usage of Context versus dict
----------------------------------+--------------------------------------
Reporter: JeroenPeterBos | Owner: nobody
Type: Bug | Status: closed
Component: Documentation | Version: 2.1
Severity: Normal | Resolution: invalid
Keywords: Deprecated Usage | Triage Stage: Unreviewed
Has patch: 0 | Needs documentation: 0

Needs tests: 0 | Patch needs improvement: 0
Easy pickings: 0 | UI/UX: 0
----------------------------------+--------------------------------------
Changes (by Tim Graham):

* status: new => closed
* resolution: => invalid


Comment:

It's `django.template.backends.django.Template.render()` that can't be
called with `Context`. `django.template.Template.render()` must be called
with `Context`.

--
Ticket URL: <https://code.djangoproject.com/ticket/29639#comment:1>

Reply all
Reply to author
Forward
0 new messages