Code

Opened 6 years ago

Closed 6 years ago

#6426 closed (fixed)

Documentation fault at #writing-custom-template-tags, load_template

Reported by: panni@… Owned by: nobody
Component: Documentation Version: master
Severity: Keywords: #writing-custom-template-tags, custom template tags, load_template
Cc: Triage Stage: Accepted
Has patch: yes Needs documentation: no
Needs tests: no Patch needs improvement: no
Easy pickings: UI/UX:

Description

Auto-escaping considerations >> New in Django development version states:

def render(self, context):
    t = template.load_template('small_fragment.html')
    return t.render(Context({'var': obj}, autoescape=context.autoescape))

This simply won't work because you're referring to django.template.load_template, which doesn't exist.
You probably mean django.template.loader.get_template(), or render_to_string().

Attachments (0)

Change History (2)

comment:1 Changed 6 years ago by SmileyChris

  • Needs documentation unset
  • Needs tests unset
  • Patch needs improvement unset
  • Triage Stage changed from Unreviewed to Accepted

comment:2 Changed 6 years ago by mtredinnick

  • Resolution set to fixed
  • Status changed from new to closed

(In [7130]) Fixed a few errors in the documentation. Thanks, Matthew Flanagan, panni@… and adamv.

Fixed #6411, #6426, #6524, #6555.

Add Comment

Modify Ticket

Change Properties
<Author field>
Action
as closed
as The resolution will be set. Next status will be 'closed'
The resolution will be deleted. Next status will be 'new'
Author


E-mail address and user name can be saved in the Preferences.

 
Note: See TracTickets for help on using tickets.