Opened 19 years ago

Closed 19 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: no UI/UX: no

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

Change History (5)

comment:1 by Adrian Holovaty, 19 years ago

Resolution: fixed
Status: newclosed

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

comment:2 by anonymous, 19 years ago

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 by Boffbowsh, 19 years ago

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 by Boffbowsh, 19 years ago

Resolution: fixed
Status: closedreopened

comment:5 by Adrian Holovaty, 19 years ago

Resolution: invalid
Status: reopenedclosed

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

Note: See TracTickets for help on using tickets.
Back to Top