From df4a74d7097f15cc271fee1c797dee3b96755066 Mon Sep 17 00:00:00 2001 From: Harm Geerts Date: Thu, 20 Jun 2013 03:02:25 +0200 Subject: Modified tutorial 3 to use RequestContext in place of Context. --- docs/intro/tutorial03.txt | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) (limited to 'docs/intro') diff --git a/docs/intro/tutorial03.txt b/docs/intro/tutorial03.txt index 6193ec45f7..d9f3f50a0d 100644 --- a/docs/intro/tutorial03.txt +++ b/docs/intro/tutorial03.txt @@ -339,14 +339,14 @@ Put the following code in that template: Now let's update our ``index`` view in ``polls/views.py`` to use the template:: from django.http import HttpResponse - from django.template import Context, loader + from django.template import RequestContext, loader from polls.models import Poll def index(request): latest_poll_list = Poll.objects.order_by('-pub_date')[:5] template = loader.get_template('polls/index.html') - context = Context({ + context = RequestContext({ 'latest_poll_list': latest_poll_list, }) return HttpResponse(template.render(context)) @@ -377,7 +377,7 @@ rewritten:: return render(request, 'polls/index.html', context) Note that once we've done this in all these views, we no longer need to import -:mod:`~django.template.loader`, :class:`~django.template.Context` and +:mod:`~django.template.loader`, :class:`~django.template.RequestContext` and :class:`~django.http.HttpResponse` (you'll want to keep ``HttpResponse`` if you still have the stub methods for ``detail``, ``results``, and ``vote``). -- cgit v1.3 From 6ef199a08e1c452289deda67629b1630d25ccfcf Mon Sep 17 00:00:00 2001 From: Tim Graham Date: Thu, 20 Jun 2013 10:41:29 -0400 Subject: Fixed error in last commit. Thanks Simon Charette. --- docs/intro/tutorial03.txt | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'docs/intro') diff --git a/docs/intro/tutorial03.txt b/docs/intro/tutorial03.txt index d9f3f50a0d..91409848cf 100644 --- a/docs/intro/tutorial03.txt +++ b/docs/intro/tutorial03.txt @@ -346,7 +346,7 @@ Now let's update our ``index`` view in ``polls/views.py`` to use the template:: def index(request): latest_poll_list = Poll.objects.order_by('-pub_date')[:5] template = loader.get_template('polls/index.html') - context = RequestContext({ + context = RequestContext(request, { 'latest_poll_list': latest_poll_list, }) return HttpResponse(template.render(context)) -- cgit v1.3 From 5caced89e0ac2f942b68bc5f163d156a42880f16 Mon Sep 17 00:00:00 2001 From: Baptiste Mispelon Date: Fri, 28 Jun 2013 09:43:14 +0200 Subject: Fixed missing slash in reusable apps tutorial. --- docs/intro/reusable-apps.txt | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'docs/intro') diff --git a/docs/intro/reusable-apps.txt b/docs/intro/reusable-apps.txt index 4247b45238..879cda913a 100644 --- a/docs/intro/reusable-apps.txt +++ b/docs/intro/reusable-apps.txt @@ -67,7 +67,7 @@ After the previous tutorials, our project should look like this:: admin.py models.py static/ - polls + polls/ images/ background.gif style.css -- cgit v1.3