Code

Opened 9 years ago

Closed 9 years ago

#591 closed defect (invalid)

[patch] Docs: Subclassing wrong object

Reported by: Boffbowsh Owned by: jacob
Component: Documentation Version:
Severity: normal Keywords:
Cc: Triage Stage: Unreviewed
Has patch: yes Needs documentation: no
Needs tests: no Patch needs improvement: no
Easy pickings: UI/UX:

Description

Index: /usr/local/django_src/docs/templates_python.txt
===================================================================
--- /usr/local/django_src/docs/templates_python.txt     (revision 764)
+++ /usr/local/django_src/docs/templates_python.txt     (working copy)
@@ -267,7 +267,7 @@
 
     from django.core.template import Context
     import datetime
-    class TimeContext(template.Context):
+    class TimeContext(Context):
         def __init__(self, *args, **kwargs):
             Context.__init__(self, *args, **kwargs)
             self['current_time'] = datetime.datetime.now()

Attachments (0)

Change History (5)

comment:1 Changed 9 years ago by adrian

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

(In [771]) Fixed #591 -- fixed typo in docs/templates_python.txt. Thanks, Boffbowsh

comment:2 Changed 9 years ago by anonymous

Actually, just realised, it should be:

Index: /usr/local/django_src/docs/templates_python.txt
===================================================================
--- /usr/local/django_src/docs/templates_python.txt     (revision 764)
+++ /usr/local/django_src/docs/templates_python.txt     (working copy)
@@ -265,9 +265,9 @@
 each template something "automatically." For instance, if you want to give
 every template automatic access to the current time, use something like this::
 
-    from django.core.template import Context
+    from django.core.extensions import DjangoContext as Context
     import datetime
-    class TimeContext(template.Context):
+    class TimeContext(Context):
         def __init__(self, *args, **kwargs):
             Context.__init__(self, *args, **kwargs)
             self['current_time'] = datetime.datetime.now()

comment:3 Changed 9 years ago by Boffbowsh

3rd time lucky:

Index: /usr/local/django_src/docs/templates_python.txt
===================================================================
--- /usr/local/django_src/docs/templates_python.txt     (revision 771)
+++ /usr/local/django_src/docs/templates_python.txt     (working copy)
@@ -265,7 +265,7 @@
 each template something "automatically." For instance, if you want to give
 every template automatic access to the current time, use something like this::
 
-    from django.core.template import Context
+    from django.core.extensions import DjangoContext as Context
     import datetime
     class TimeContext(Context):
         def __init__(self, *args, **kwargs):

comment:4 Changed 9 years ago by Boffbowsh

  • Resolution fixed deleted
  • Status changed from closed to reopened

comment:5 Changed 9 years ago by adrian

  • Resolution set to invalid
  • Status changed from reopened to closed

It's correct as currently written -- there's no need to use DjangoContext in this example.

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.