Opened 5 years ago
Closed 3 years ago
#30923 closed Cleanup/optimization (fixed)
Out of date examples in docs that call render() with a Context instance instead of regular dict — at Version 16
Reported by: | Alasdair Nicol | Owned by: | |
---|---|---|---|
Component: | Documentation | Version: | dev |
Severity: | Normal | Keywords: | Context render template |
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 )
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.
- docs/ref/contrib/sites.txt - I will open a pull request for this
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()
.
Change History (16)
comment:1 by , 5 years ago
comment:2 by , 5 years ago
Component: | Uncategorized → Documentation |
---|---|
Keywords: | Context render template added |
Version: | 2.2 → master |
comment:3 by , 5 years ago
Triage Stage: | Unreviewed → Accepted |
---|
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 by , 5 years ago
Type: | Uncategorized → Cleanup/optimization |
---|
comment:5 by , 5 years ago
Has patch: | set |
---|---|
Patch needs improvement: | set |
The PR does not pass the checks, please update the PR.
comment:7 by , 5 years ago
Has patch: | unset |
---|
comment:11 by , 5 years ago
Has patch: | set |
---|---|
Resolution: | → fixed |
Status: | new → closed |
Triage Stage: | Accepted → Ready for checkin |
The patch was applied to master, im closing the ticket.
comment:12 by , 5 years ago
Has patch: | unset |
---|---|
Resolution: | fixed |
Status: | closed → new |
Triage Stage: | Ready for checkin → Accepted |
Please don't close tickets that are not fixed. howto/custom-template-tags.txt
is waiting for a fix.
comment:13 by , 5 years ago
Owner: | changed from | to
---|---|
Status: | new → assigned |
comment:14 by , 3 years ago
Owner: | removed |
---|---|
Status: | assigned → new |
comment:15 by , 3 years ago
Has patch: | set |
---|
I created a PR for the custom template tags docs: https://github.com/django/django/pull/15495
comment:16 by , 3 years ago
Description: | modified (diff) |
---|---|
Resolution: | → fixed |
Status: | new → closed |
Examples in howto/custom-template-tags.txt
work with Context()
. Closing as fixed.
Pull request for sites docs: https://github.com/django/django/pull/11984