Re: Help Converting a Query getting one result using .filter() to .get()

2010-07-13 Thread Chris McComas
Sorry, I should've said what I'm using it for... Here's my models http://dpaste.com/217686/ The query above I just want to get the next/upcoming game in the database, which I display on the sidebar of the front page. What I am trying to do, is also get ALL other entries from the database, in a se

Re: Help Converting a Query getting one result using .filter() to .get()

2010-07-12 Thread John M
Why does it matter? You could just say next_game[0] instead. J On Jul 12, 4:28 pm, Chris McComas wrote: > I have this query, trying to get the next game in the future. > > today = datetime.datetime.now() > next_game = Game.objects.filter(date__gt=today).order_by('date')[:1] > > I need to use .g

Help Converting a Query getting one result using .filter() to .get()

2010-07-12 Thread Chris McComas
I have this query, trying to get the next game in the future. today = datetime.datetime.now() next_game = Game.objects.filter(date__gt=today).order_by('date')[:1] I need to use .get() if possible, instead of .filter() how can I do this? -- You received this message because you are subscribed to