Re: Problems selecting correct object in view

2008-02-16 Thread Tim Sawyer
On Saturday 16 Feb 2008, Nils L wrote: > Hi Tim, > Contest.objects.filter(pk=pSerial) yields a list (in this case of > length 1), not a Contest object. If you want to fetch a single object > based on it's primary key you can use: Contest.objects.get(pk=pSerial) > See http://www.djangoproject.com/d

Re: Problems selecting correct object in view

2008-02-16 Thread Nils L
Hi Tim, Contest.objects.filter(pk=pSerial) yields a list (in this case of length 1), not a Contest object. If you want to fetch a single object based on it's primary key you can use: Contest.objects.get(pk=pSerial) See http://www.djangoproject.com/documentation/tutorial01/ - Nils --~--~-~

Problems selecting correct object in view

2008-02-16 Thread Tim Sawyer
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_respons