[Django] #30923: Out of date examples in docs that call render() with a Context instance instead of regular dict

18 views
Skip to first unread message

Django

unread,
Oct 28, 2019, 10:16:44 AM10/28/19
to django-...@googlegroups.com
#30923: Out of date examples in docs that call render() with a Context instance
instead of regular dict
------------------------------------------+------------------------
Reporter: Alasdair Nicol | Owner: nobody
Type: Uncategorized | Status: new
Component: Uncategorized | Version: 2.2
Severity: Normal | Keywords:
Triage Stage: Unreviewed | Has patch: 0
Needs documentation: 0 | Needs tests: 0
Patch needs improvement: 0 | Easy pickings: 0
UI/UX: 0 |
------------------------------------------+------------------------
Following #30906, I found a couple more examples in the docs that are
calling the template's render method with a Context instance when they
should use a regular dict.

* [https://docs.djangoproject.com/en/2.2/ref/contrib/sites/#getting-the-
current-domain-for-display docs/ref/contrib/sites.txt ] - I will open a
pull request for this
* [https://docs.djangoproject.com/en/2.2/howto/custom-template-tags
/#auto-escaping-considerations howto/custom-template-tags.txt] - I am not
sure how to rewrite this example.

I found these by searching with the following commands:

{{{
cd docs
git grep 'render.*Context'
git grep 'from django.*import.*Context'
}}}

Those grep commands also return results from `ref/templates/api.txt`, but
they are ok because they use `t = Template()` instead of
`loader.get_template()`.

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

Django

unread,
Oct 28, 2019, 10:22:57 AM10/28/19
to django-...@googlegroups.com
#30923: Out of date examples in docs that call render() with a Context instance
instead of regular dict
--------------------------------+--------------------------------------

Reporter: Alasdair Nicol | Owner: nobody
Type: Uncategorized | Status: new
Component: Uncategorized | Version: 2.2
Severity: Normal | Resolution:

Keywords: | Triage Stage: Unreviewed
Has patch: 0 | Needs documentation: 0
Needs tests: 0 | Patch needs improvement: 0
Easy pickings: 0 | UI/UX: 0
--------------------------------+--------------------------------------

Comment (by Alasdair Nicol):

Pull request for sites docs: https://github.com/django/django/pull/11984

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

Django

unread,
Oct 28, 2019, 10:24:42 AM10/28/19
to django-...@googlegroups.com
#30923: Out of date examples in docs that call render() with a Context instance
instead of regular dict
-------------------------------------+-------------------------------------

Reporter: Alasdair Nicol | Owner: nobody
Type: Uncategorized | Status: new
Component: Documentation | Version: master
Severity: Normal | Resolution:
Keywords: Context render | Triage Stage:
template | Unreviewed

Has patch: 0 | Needs documentation: 0
Needs tests: 0 | Patch needs improvement: 0
Easy pickings: 0 | UI/UX: 0
-------------------------------------+-------------------------------------
Changes (by Alasdair Nicol):

* keywords: => Context render template
* version: 2.2 => master
* component: Uncategorized => Documentation


--
Ticket URL: <https://code.djangoproject.com/ticket/30923#comment:2>

Django

unread,
Oct 28, 2019, 5:35:02 PM10/28/19
to django-...@googlegroups.com
#30923: Out of date examples in docs that call render() with a Context instance
instead of regular dict
-------------------------------------+-------------------------------------

Reporter: Alasdair Nicol | Owner: nobody
Type: Uncategorized | Status: new
Component: Documentation | Version: master
Severity: Normal | Resolution:
Keywords: Context render | Triage Stage: Accepted
template |

Has patch: 0 | Needs documentation: 0
Needs tests: 0 | Patch needs improvement: 0
Easy pickings: 0 | UI/UX: 0
-------------------------------------+-------------------------------------
Changes (by Claude Paroz):

* stage: Unreviewed => Accepted


Comment:

For the auto-escaping case, the solution I'm using is to define a custom
template engine with `OPTIONS` containing `'autoescape': False,`. I don't
know if this is the recommended new way of doing what the current example
does.

--
Ticket URL: <https://code.djangoproject.com/ticket/30923#comment:3>

Django

unread,
Oct 29, 2019, 3:45:26 AM10/29/19
to django-...@googlegroups.com
#30923: Out of date examples in docs that call render() with a Context instance
instead of regular dict
-------------------------------------+-------------------------------------

Reporter: Alasdair Nicol | Owner: nobody
Type: | Status: new
Cleanup/optimization |

Component: Documentation | Version: master
Severity: Normal | Resolution:
Keywords: Context render | Triage Stage: Accepted
template |
Has patch: 0 | Needs documentation: 0
Needs tests: 0 | Patch needs improvement: 0
Easy pickings: 0 | UI/UX: 0
-------------------------------------+-------------------------------------
Changes (by felixxm):

* type: Uncategorized => Cleanup/optimization


--
Ticket URL: <https://code.djangoproject.com/ticket/30923#comment:4>

Django

unread,
Nov 4, 2019, 4:28:27 PM11/4/19
to django-...@googlegroups.com
#30923: Out of date examples in docs that call render() with a Context instance
instead of regular dict
-------------------------------------+-------------------------------------

Reporter: Alasdair Nicol | Owner: nobody
Type: | Status: new
Cleanup/optimization |
Component: Documentation | Version: master
Severity: Normal | Resolution:
Keywords: Context render | Triage Stage: Accepted
template |
Has patch: 1 | Needs documentation: 0
Needs tests: 0 | Patch needs improvement: 1

Easy pickings: 0 | UI/UX: 0
-------------------------------------+-------------------------------------
Changes (by CarlosMirdeSouza):

* needs_better_patch: 0 => 1
* has_patch: 0 => 1


Comment:

The PR does not pass the checks, please update the PR.

--
Ticket URL: <https://code.djangoproject.com/ticket/30923#comment:5>

Django

unread,
Nov 5, 2019, 1:38:35 AM11/5/19
to django-...@googlegroups.com
#30923: Out of date examples in docs that call render() with a Context instance
instead of regular dict
-------------------------------------+-------------------------------------

Reporter: Alasdair Nicol | Owner: nobody
Type: | Status: new
Cleanup/optimization |
Component: Documentation | Version: master
Severity: Normal | Resolution:
Keywords: Context render | Triage Stage: Accepted
template |
Has patch: 1 | Needs documentation: 0

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

* needs_better_patch: 1 => 0


Comment:

Tests failures are not related.

--
Ticket URL: <https://code.djangoproject.com/ticket/30923#comment:6>

Django

unread,
Nov 5, 2019, 6:43:28 AM11/5/19
to django-...@googlegroups.com
#30923: Out of date examples in docs that call render() with a Context instance
instead of regular dict
-------------------------------------+-------------------------------------

Reporter: Alasdair Nicol | Owner: nobody
Type: | Status: new
Cleanup/optimization |
Component: Documentation | Version: master
Severity: Normal | Resolution:
Keywords: Context render | Triage Stage: Accepted
template |
Has patch: 0 | Needs documentation: 0
Needs tests: 0 | Patch needs improvement: 0
Easy pickings: 0 | UI/UX: 0
-------------------------------------+-------------------------------------
Changes (by felixxm):

* has_patch: 1 => 0


--
Ticket URL: <https://code.djangoproject.com/ticket/30923#comment:7>

Django

unread,
Nov 5, 2019, 7:06:14 AM11/5/19
to django-...@googlegroups.com
#30923: Out of date examples in docs that call render() with a Context instance
instead of regular dict
-------------------------------------+-------------------------------------

Reporter: Alasdair Nicol | Owner: nobody
Type: | Status: new
Cleanup/optimization |
Component: Documentation | Version: master
Severity: Normal | Resolution:
Keywords: Context render | Triage Stage: Accepted
template |
Has patch: 0 | Needs documentation: 0
Needs tests: 0 | Patch needs improvement: 0
Easy pickings: 0 | UI/UX: 0
-------------------------------------+-------------------------------------

Comment (by Mariusz Felisiak <felisiak.mariusz@…>):

In [changeset:"b991eefd3a9fa4da4eb46fddcb36cf1e8b5862e9" b991eefd]:
{{{
#!CommitTicketReference repository=""
revision="b991eefd3a9fa4da4eb46fddcb36cf1e8b5862e9"
Refs #30923 -- Fixed an example of rendering templates in contrib.sites
docs.
}}}

--
Ticket URL: <https://code.djangoproject.com/ticket/30923#comment:8>

Django

unread,
Nov 5, 2019, 7:06:53 AM11/5/19
to django-...@googlegroups.com
#30923: Out of date examples in docs that call render() with a Context instance
instead of regular dict
-------------------------------------+-------------------------------------

Reporter: Alasdair Nicol | Owner: nobody
Type: | Status: new
Cleanup/optimization |
Component: Documentation | Version: master
Severity: Normal | Resolution:
Keywords: Context render | Triage Stage: Accepted
template |
Has patch: 0 | Needs documentation: 0
Needs tests: 0 | Patch needs improvement: 0
Easy pickings: 0 | UI/UX: 0
-------------------------------------+-------------------------------------

Comment (by Mariusz Felisiak <felisiak.mariusz@…>):

In [changeset:"78fc05303af90b8a693cb2868ced3b2c9daa176c" 78fc0530]:
{{{
#!CommitTicketReference repository=""
revision="78fc05303af90b8a693cb2868ced3b2c9daa176c"
[3.0.x] Refs #30923 -- Fixed an example of rendering templates in
contrib.sites docs.

Backport of b991eefd3a9fa4da4eb46fddcb36cf1e8b5862e9 from master
}}}

--
Ticket URL: <https://code.djangoproject.com/ticket/30923#comment:9>

Django

unread,
Nov 5, 2019, 7:07:58 AM11/5/19
to django-...@googlegroups.com
#30923: Out of date examples in docs that call render() with a Context instance
instead of regular dict
-------------------------------------+-------------------------------------

Reporter: Alasdair Nicol | Owner: nobody
Type: | Status: new
Cleanup/optimization |
Component: Documentation | Version: master
Severity: Normal | Resolution:
Keywords: Context render | Triage Stage: Accepted
template |
Has patch: 0 | Needs documentation: 0
Needs tests: 0 | Patch needs improvement: 0
Easy pickings: 0 | UI/UX: 0
-------------------------------------+-------------------------------------

Comment (by Mariusz Felisiak <felisiak.mariusz@…>):

In [changeset:"406fb336b75663a0131251f9414d8cf5cc43e09b" 406fb336]:
{{{
#!CommitTicketReference repository=""
revision="406fb336b75663a0131251f9414d8cf5cc43e09b"
[2.2.x] Refs #30923 -- Fixed an example of rendering templates in
contrib.sites docs.

Backport of b991eefd3a9fa4da4eb46fddcb36cf1e8b5862e9 from master
}}}

--
Ticket URL: <https://code.djangoproject.com/ticket/30923#comment:10>

Django

unread,
Nov 5, 2019, 8:31:53 AM11/5/19
to django-...@googlegroups.com
#30923: Out of date examples in docs that call render() with a Context instance
instead of regular dict
-------------------------------------+-------------------------------------

Reporter: Alasdair Nicol | Owner: nobody
Type: | Status: closed

Cleanup/optimization |
Component: Documentation | Version: master
Severity: Normal | Resolution: fixed
Keywords: Context render | Triage Stage: Ready for
template | checkin
Has patch: 1 | Needs documentation: 0

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

* status: new => closed


* has_patch: 0 => 1

* resolution: => fixed
* stage: Accepted => Ready for checkin


Comment:

The patch was applied to master, im closing the ticket.

--
Ticket URL: <https://code.djangoproject.com/ticket/30923#comment:11>

Django

unread,
Nov 5, 2019, 8:36:52 AM11/5/19
to django-...@googlegroups.com
#30923: Out of date examples in docs that call render() with a Context instance
instead of regular dict
-------------------------------------+-------------------------------------

Reporter: Alasdair Nicol | Owner: nobody
Type: | Status: new

Cleanup/optimization |
Component: Documentation | Version: master
Severity: Normal | Resolution:
Keywords: Context render | Triage Stage: Accepted
template |

Has patch: 0 | Needs documentation: 0
Needs tests: 0 | Patch needs improvement: 0
Easy pickings: 0 | UI/UX: 0
-------------------------------------+-------------------------------------
Changes (by felixxm):

* status: closed => new


* has_patch: 1 => 0

* resolution: fixed =>
* stage: Ready for checkin => Accepted


Comment:

Please don't close tickets that are not fixed. `howto/custom-template-
tags.txt` is waiting for a fix.

--
Ticket URL: <https://code.djangoproject.com/ticket/30923#comment:12>

Django

unread,
Jan 20, 2020, 2:38:03 PM1/20/20
to django-...@googlegroups.com
#30923: Out of date examples in docs that call render() with a Context instance
instead of regular dict
-------------------------------------+-------------------------------------
Reporter: Alasdair Nicol | Owner: Daniel
Type: | Rios
Cleanup/optimization | Status: assigned

Component: Documentation | Version: master
Severity: Normal | Resolution:
Keywords: Context render | Triage Stage: Accepted
template |
Has patch: 0 | Needs documentation: 0
Needs tests: 0 | Patch needs improvement: 0
Easy pickings: 0 | UI/UX: 0
-------------------------------------+-------------------------------------
Changes (by Daniel Rios):

* owner: nobody => Daniel Rios
* status: new => assigned


--
Ticket URL: <https://code.djangoproject.com/ticket/30923#comment:13>

Django

unread,
Nov 18, 2021, 4:05:19 AM11/18/21
to django-...@googlegroups.com
#30923: Out of date examples in docs that call render() with a Context instance
instead of regular dict
-------------------------------------+-------------------------------------
Reporter: Alasdair Nicol | Owner: (none)
Type: | Status: new
Cleanup/optimization |
Component: Documentation | Version: dev

Severity: Normal | Resolution:
Keywords: Context render | Triage Stage: Accepted
template |
Has patch: 0 | Needs documentation: 0
Needs tests: 0 | Patch needs improvement: 0
Easy pickings: 0 | UI/UX: 0
-------------------------------------+-------------------------------------
Changes (by Mariusz Felisiak):

* owner: Daniel Rios => (none)
* status: assigned => new


--
Ticket URL: <https://code.djangoproject.com/ticket/30923#comment:14>

Django

unread,
Mar 9, 2022, 11:36:44 AM3/9/22
to django-...@googlegroups.com
#30923: Out of date examples in docs that call render() with a Context instance
instead of regular dict
-------------------------------------+-------------------------------------
Reporter: Alasdair Nicol | Owner: (none)
Type: | Status: new
Cleanup/optimization |
Component: Documentation | Version: dev
Severity: Normal | Resolution:
Keywords: Context render | Triage Stage: Accepted
template |
Has patch: 1 | Needs documentation: 0

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

* has_patch: 0 => 1


Comment:

I created a PR for the custom template tags docs:
https://github.com/django/django/pull/15495

--
Ticket URL: <https://code.djangoproject.com/ticket/30923#comment:15>

Django

unread,
Mar 10, 2022, 12:55:34 AM3/10/22
to django-...@googlegroups.com
#30923: Out of date examples in docs that call render() with a Context instance
instead of regular dict
-------------------------------------+-------------------------------------
Reporter: Alasdair Nicol | Owner: (none)
Type: | Status: closed

Cleanup/optimization |
Component: Documentation | Version: dev
Severity: Normal | Resolution: fixed

Keywords: Context render | Triage Stage: Accepted
template |
Has patch: 1 | Needs documentation: 0

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

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


Old description:

> Following #30906, I found a couple more examples in the docs that are
> calling the template's render method with a Context instance when they
> should use a regular dict.
>
> * [https://docs.djangoproject.com/en/2.2/ref/contrib/sites/#getting-the-
> current-domain-for-display docs/ref/contrib/sites.txt ] - I will open a
> pull request for this
> * [https://docs.djangoproject.com/en/2.2/howto/custom-template-tags
> /#auto-escaping-considerations howto/custom-template-tags.txt] - I am not
> sure how to rewrite this example.
>
> I found these by searching with the following commands:
>
> {{{
> cd docs
> git grep 'render.*Context'
> git grep 'from django.*import.*Context'
> }}}
>
> Those grep commands also return results from `ref/templates/api.txt`, but
> they are ok because they use `t = Template()` instead of
> `loader.get_template()`.

New description:

Following #30906, I found a couple more examples in the docs that are
calling the template's render method with a Context instance when they
should use a regular dict.

* [https://docs.djangoproject.com/en/2.2/ref/contrib/sites/#getting-the-
current-domain-for-display docs/ref/contrib/sites.txt ] - I will open a
pull request for this

* ~~[https://docs.djangoproject.com/en/2.2/howto/custom-template-tags


/#auto-escaping-considerations howto/custom-template-tags.txt] - I am not

sure how to rewrite this example.~~

I found these by searching with the following commands:

{{{
cd docs
git grep 'render.*Context'
git grep 'from django.*import.*Context'
}}}

Those grep commands also return results from `ref/templates/api.txt`, but
they are ok because they use `t = Template()` instead of
`loader.get_template()`.

--

Comment:

Examples in `howto/custom-template-tags.txt` work with `Context()`.
Closing as fixed.

--
Ticket URL: <https://code.djangoproject.com/ticket/30923#comment:16>

Reply all
Reply to author
Forward
0 new messages