diff --git a/docs/templates_python.txt b/docs/templates_python.txt index 3d6bfd7040e..a6b565ed5ca 100644 --- a/docs/templates_python.txt +++ b/docs/templates_python.txt @@ -829,12 +829,12 @@ Now your tag should begin to look like this:: def do_format_time(parser, token): try: # split_contents() knows not to split quoted strings. - tag_name, date_to_format, format_string = token.split_contents() + tag_name, date_to_be_formatted, format_string = token.split_contents() except ValueError: raise template.TemplateSyntaxError, "%r tag requires exactly two arguments" % token.contents[0] if not (format_string[0] == format_string[-1] and format_string[0] in ('"', "'")): raise template.TemplateSyntaxError, "%r tag's argument should be in quotes" % tag_name - return FormatTimeNode(date_to_format, format_string[1:-1]) + return FormatTimeNode(date_to_be_formatted, format_string[1:-1]) You also have to change the renderer to retrieve the actual contents of the ``date_updated`` property of the ``blog_entry`` object. This can be @@ -846,13 +846,13 @@ current context, available in the ``render`` method:: from django.template import resolve_variable import datetime class FormatTimeNode(template.Node): - def __init__(self, date_to_format, format_string): - self.date_to_format = date_to_format + def __init__(self, date_to_be_formatted, format_string): + self.date_to_be_formatted = date_to_be_formatted self.format_string = format_string def render(self, context): try: - actual_date = resolve_variable(self.date_to_format, context) + actual_date = resolve_variable(self.date_to_be_formatted, context) return actual_date.strftime(self.format_string) except VariableDoesNotExist: return ''