Opened 10 months ago

Last modified 7 months ago

#30923 assigned Cleanup/optimization

Out of date examples in docs that call render() with a Context instance instead of regular dict

Reported by: Alasdair Nicol Owned by: Daniel Rios
Component: Documentation Version: master
Severity: Normal Keywords: Context render template
Cc: Triage Stage: Accepted
Has patch: no Needs documentation: no
Needs tests: no Patch needs improvement: no
Easy pickings: no UI/UX: no

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.

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().

Change History (13)

comment:1 Changed 10 months ago by Alasdair Nicol

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

comment:2 Changed 10 months ago by Alasdair Nicol

Component: UncategorizedDocumentation
Keywords: Context render template added
Version: 2.2master

comment:3 Changed 10 months ago by Claude Paroz

Triage Stage: UnreviewedAccepted

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.

comment:4 Changed 10 months ago by felixxm

Type: UncategorizedCleanup/optimization

comment:5 Changed 9 months ago by Carlos_Mir_de_Souza

Has patch: set
Patch needs improvement: set

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

comment:6 Changed 9 months ago by felixxm

Patch needs improvement: unset

Tests failures are not related.

comment:7 Changed 9 months ago by felixxm

Has patch: unset

comment:8 Changed 9 months ago by Mariusz Felisiak <felisiak.mariusz@…>

In b991eefd:

Refs #30923 -- Fixed an example of rendering templates in contrib.sites docs.

comment:9 Changed 9 months ago by Mariusz Felisiak <felisiak.mariusz@…>

In 78fc0530:

[3.0.x] Refs #30923 -- Fixed an example of rendering templates in contrib.sites docs.

Backport of b991eefd3a9fa4da4eb46fddcb36cf1e8b5862e9 from master

comment:10 Changed 9 months ago by Mariusz Felisiak <felisiak.mariusz@…>

In 406fb336:

[2.2.x] Refs #30923 -- Fixed an example of rendering templates in contrib.sites docs.

Backport of b991eefd3a9fa4da4eb46fddcb36cf1e8b5862e9 from master

comment:11 Changed 9 months ago by Carlos_Mir_de_Souza

Has patch: set
Resolution: fixed
Status: newclosed
Triage Stage: AcceptedReady for checkin

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

comment:12 Changed 9 months ago by felixxm

Has patch: unset
Resolution: fixed
Status: closednew
Triage Stage: Ready for checkinAccepted

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

comment:13 Changed 7 months ago by Daniel Rios

Owner: changed from nobody to Daniel Rios
Status: newassigned
Note: See TracTickets for help on using tickets.
Back to Top