Hi Show your template file
2011/3/14 royy <cds.oficia...@gmail.com> > Hi. > > I've finished the tutorial for the polls app. > > I tought everythin was OK till I load the server and type the addres: > http://127.0.0.1:8000/polls/ > > web browser shows me the message "No polls are available" isn't a web > browser error message, because it is plain text. > > I've created 3 polls with 3 choices each one. > > admin page works fine, just the polls address is the one that don't > loads well. This is my final views.py code: > > 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 polls.models import Choice, Poll > > def vote(request, poll_id): > p = get_object_or_404(Poll, pk=poll_id) > try: > selected_choice = p.choice_set.get(pk=request.POST['choice']) > except (KeyError, Choice.DoesNotExist): > > return render_to_response('polls/poll_detail.html', { > 'poll': p, > 'error_message': "You didn't select a choice.", > }, context_instance=RequestContext(request)) > else: > selected_choice.votes += 1 > selected_choice.save() > return HttpResponseRedirect(reverse('poll_results', > args=(p.id,))) > > > ------------------------------------------------------------------------------------------------------------------------- > > and this is my final polls/urls.py code: > > from django.conf.urls.defaults import * > from polls.models import Poll > > info_dict = { > 'queryset': Poll.objects.all(), > } > > urlpatterns = patterns('', > (r'^$', 'django.views.generic.list_detail.object_list', > info_dict), > (r'^(?P<object_id>\d+)/$', > 'django.views.generic.list_detail.object_detail', info_dict), > url(r'^(?P<object_id>\d+)/results/$', > 'django.views.generic.list_detail.object_detail', dict(info_dict, > template_name='polls/results.html'), 'poll_results'), > (r'^(?P<poll_id>\d+)/vote/$', 'polls.views.vote'), > ) > > > Please help me to find what's wrong. > > Thanks > > -- > 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. > > -- Best regards, Igor Ishchenko iPhone dev team NIX Solutions, Ltd. -- 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.