I'm learning Django from djangoproject https://docs.djangoproject.com/en/1.5/intro/tutorial04/.
-Currently I'm on Part-4 of this tutorial.
However, it is showing an error while fetching a record from database table Poll as :
def detail(request, poll_id):
poll = get_object_or_404(Poll, pk=poll_id)
context = {'poll' : poll}
return render(request,'polls/detail.html', context)
It shows an error :
ValueError at /polls/2/
invalid literal for int() with base 10: ''
Please help with the issue........as i am completely a newbie to this framework. I'm using MySql as my DBMS. This is how my urls.py looks like :
from django.conf.urls import patterns, url
from polls import views
urlpatterns = patterns('',
url(r'^$', views.index, name='index'),
url(r'^(?P)\d+/$', views.detail, name='detail'),
url(r'^(?P)\d+/results/$', views.results, name='results'),
url(r'^(?P)\d+/vote/$', views.vote, name='vote')
)
Thanks in Advance
poll_idtoint- Amit Yadavpoll_id. Try to add aprint poll_id'statement just after thedefline to see whatpoll_id's got - Amit Yadav