On Jun 9, 11:21 am, Jipe <jpville...@gmail.com> wrote:
> Hi all,
> I 'm trying to use the Django Tutorial 3 for beginners.
> I've met some problems.
> Until you have to work with the template and index.html, it's ok
> But when i try to make appear detail.html who is in the same template
> directory as index.html, no way...
> It tolds me page not found...
> I really don't understand.
> If someone have a answer, i 'll appreciate.
> I m' working on windows xp...i know...:p
> Thanks
>
> Here is my view.py
>
> from django.shortcuts import render_to_response
> from mysite.polls.models import Poll
> from django.http import Http404
> # ...
> def detail(request, poll_id):
>     try:
>         p = Poll.objects.get(pk=poll_id)
>     except Poll.DoesNotExist:
>         raise Http404
>     return render_to_response('polls/detail.html', {'poll': p})
>
> def index(request):
>     latest_poll_list = Poll.objects.all().order_by('-pub_date')[:5]
>     return render_to_response('polls/index.html', {'latest_poll_list':
> latest_poll_list})
>
> *********************
> Url.py from django.conf.urls.defaults import *
>
> # Uncomment the next two lines to enable the admin:
> from django.contrib import admin
> admin.autodiscover()
>
> urlpatterns = patterns('',
>
>     (r'^polls/(?P<poll_id>\d+)/$', 'mysite.polls.views.detail'),
>     (r'^polls/$', 'mysite.polls.views.index'),
>     (r'^polls/(?P<poll_id>\d+)/results/$',
> 'mysite.polls.views.results'),
>     (r'^polls/(?P<poll_id>\d+)/vote/$', 'mysite.polls.views.vote'),
>
>     (r'^admin/', include(admin.site.urls)),
> )
>

Assuming you're going to the 'detail' view via  a URL like /polls/2/,
I'd guess that the poll with the ID you're entering does not exist, so
you're hitting the 'raise Http404' line.
--
DR.
--~--~---------~--~----~------------~-------~--~----~
You received this message because you are subscribed to the Google Groups 
"Django users" group.
To post to this group, send email to django-users@googlegroups.com
To unsubscribe from this group, send email to 
django-users+unsubscr...@googlegroups.com
For more options, visit this group at 
http://groups.google.com/group/django-users?hl=en
-~----------~----~----~----~------~----~------~--~---

Reply via email to