summaryrefslogtreecommitdiff
path: root/docs/tutorial03.txt
diff options
context:
space:
mode:
authorAdrian Holovaty <adrian@holovaty.com>2005-10-14 20:10:13 +0000
committerAdrian Holovaty <adrian@holovaty.com>2005-10-14 20:10:13 +0000
commitf71f8546283dbdf698c7578f8f9154045c84f9e7 (patch)
tree1ae0aa237970d1b67ec8504d9f3f425305b3e155 /docs/tutorial03.txt
parentb773bf45c3011dc95617dcbec9584c8d139c27cc (diff)
Fixed #626 -- Moved template modules to django.core.template package. django.core.template_loader is deprecated, in favor of django.core.template.loader.
git-svn-id: http://code.djangoproject.com/svn/django/trunk@867 bcc190cf-cafb-0310-a4f2-bffc1f526a37
Diffstat (limited to 'docs/tutorial03.txt')
-rw-r--r--docs/tutorial03.txt9
1 files changed, 4 insertions, 5 deletions
diff --git a/docs/tutorial03.txt b/docs/tutorial03.txt
index 84fb64abfe..f602bf2ebd 100644
--- a/docs/tutorial03.txt
+++ b/docs/tutorial03.txt
@@ -191,14 +191,13 @@ There's a problem here, though: The page's design is hard-coded in the view. If
you want to change the way the page looks, you'll have to edit this Python code.
So let's use Django's template system to separate the design from Python::
- from django.core import template_loader
- from django.core.template import Context
+ from django.core.template import Context, loader
from django.models.polls import polls
from django.utils.httpwrappers import HttpResponse
def index(request):
latest_poll_list = polls.get_list(order_by=['-pub_date'], limit=5)
- t = template_loader.get_template('polls/index')
+ t = loader.get_template('polls/index')
c = Context({
'latest_poll_list': latest_poll_list,
})
@@ -224,7 +223,7 @@ and feel" section of Tutorial 2.
When you've done that, create a directory ``polls`` in your template directory.
Within that, create a file called ``index.html``. Django requires that
templates have ".html" extension. Note that our
-``template_loader.get_template('polls/index')`` code from above maps to
+``loader.get_template('polls/index')`` code from above maps to
"[template_directory]/polls/index.html" on the filesystem.
Put the following code in that template::
@@ -256,7 +255,7 @@ provides a shortcut. Here's the full ``index()`` view, rewritten::
latest_poll_list = polls.get_list(order_by=['-pub_date'], limit=5)
return render_to_response('polls/index', {'latest_poll_list': latest_poll_list})
-Note that we no longer need to import ``template_loader``, ``Context`` or
+Note that we no longer need to import ``loader``, ``Context`` or
``HttpResponse``.
The ``render_to_response()`` function takes a template name as its first