From d81faf356c53c0cf099d48551e1d3982135f2db9 Mon Sep 17 00:00:00 2001 From: Simon Meers Date: Sat, 9 Oct 2010 07:45:52 +0000 Subject: Fixed #14255 -- factor project name out of app imports in tutorial. Thanks to adamend for the report and initial patch. git-svn-id: http://code.djangoproject.com/svn/django/trunk@14066 bcc190cf-cafb-0310-a4f2-bffc1f526a37 --- docs/intro/tutorial04.txt | 12 ++++++------ 1 file changed, 6 insertions(+), 6 deletions(-) (limited to 'docs/intro/tutorial04.txt') diff --git a/docs/intro/tutorial04.txt b/docs/intro/tutorial04.txt index a7a9aaea33..dfbd82df55 100644 --- a/docs/intro/tutorial04.txt +++ b/docs/intro/tutorial04.txt @@ -74,13 +74,13 @@ created a URLconf for the polls application that includes this line:: (r'^(?P\d+)/vote/$', 'vote'), We also created a dummy implementation of the ``vote()`` function. Let's -create a real version. Add the following to ``mysite/polls/views.py``:: +create a real version. Add the following to ``polls/views.py``:: from django.shortcuts import get_object_or_404, render_to_response from django.http import HttpResponseRedirect, HttpResponse from django.core.urlresolvers import reverse from django.template import RequestContext - from mysite.polls.models import Choice, Poll + from polls.models import Choice, Poll # ... def vote(request, poll_id): p = get_object_or_404(Poll, pk=poll_id) @@ -98,7 +98,7 @@ create a real version. Add the following to ``mysite/polls/views.py``:: # Always return an HttpResponseRedirect after successfully dealing # with POST data. This prevents data from being posted twice if a # user hits the Back button. - return HttpResponseRedirect(reverse('mysite.polls.views.results', args=(p.id,))) + return HttpResponseRedirect(reverse('polls.views.results', args=(p.id,))) This code includes a few things we haven't covered yet in this tutorial: @@ -222,7 +222,7 @@ tutorial so far:: from django.conf.urls.defaults import * - urlpatterns = patterns('mysite.polls.views', + urlpatterns = patterns('polls.views', (r'^$', 'index'), (r'^(?P\d+)/$', 'detail'), (r'^(?P\d+)/results/$', 'results'), @@ -232,7 +232,7 @@ tutorial so far:: Change it like so:: from django.conf.urls.defaults import * - from mysite.polls.models import Poll + from polls.models import Poll info_dict = { 'queryset': Poll.objects.all(), @@ -242,7 +242,7 @@ Change it like so:: (r'^$', 'django.views.generic.list_detail.object_list', info_dict), (r'^(?P\d+)/$', 'django.views.generic.list_detail.object_detail', info_dict), url(r'^(?P\d+)/results/$', 'django.views.generic.list_detail.object_detail', dict(info_dict, template_name='polls/results.html'), 'poll_results'), - (r'^(?P\d+)/vote/$', 'mysite.polls.views.vote'), + (r'^(?P\d+)/vote/$', 'polls.views.vote'), ) We're using two generic views here: -- cgit v1.3