Hi Folks,
I'm sure I'm missing something here, can anyone enlighten me?
In my urls.py I have:
(r'^(\d+)/$', 'rtb2.contests.views.single_contest'),
and in my views.py I have
def single_contest(request, pSerial):
lContest = Contest.objects.filter(pk=pSerial)
return render_to_response('single_contest.html', {"Contest" : lContest})
lContest seems to be null, so the html doesn't render with any content. If I
change the filter line to be
lContest = Contest.objects.all()[0]
Then it works and displays the html correctly with data in.
This code in a shell works fine:
>>> pSerial = 1
>>> lContest = Contest.objects.filter(pk=pSerial)
>>> print lContest
[<Contest: 2007-09-15 British Open>]
I am new at python. Can someone point me in the right direction please?
Thanks,
Tim.
--~--~---------~--~----~------------~-------~--~----~
You received this message because you are subscribed to the Google Groups
"Django users" group.
To post to this group, send email to [email protected]
To unsubscribe from this group, send email to [EMAIL PROTECTED]
For more options, visit this group at
http://groups.google.com/group/django-users?hl=en
-~----------~----~----~----~------~----~------~--~---