Re: Empty Result set

2008-05-07 Thread Julien
How about result_set.count()>0, if it's a queryset object, or len(result_set)>0 if it's a list? On May 7, 5:05 pm, "Guillaume Lederrey" <[EMAIL PROTECTED]> wrote: > 2008/5/6 jwwest <[EMAIL PROTECTED]>: > > > What's the preferred method of checking to see if a result set is > > empty in a view?

Re: Empty Result set

2008-05-07 Thread Guillaume Lederrey
2008/5/6 jwwest <[EMAIL PROTECTED]>: > What's the preferred method of checking to see if a result set is > empty in a view? For instance, I'm writing blog software and have a > view by year method. If there are no posts, I want to raise a http404. > > I've tried == {} and == [] to no avail. M

Re: Empty Result set

2008-05-06 Thread Richard Dahl
try this: result_set = Model.objects.all() if result_set: result_set has data else: result_set is empty On 5/6/08, jwwest <[EMAIL PROTECTED]> wrote: > > What's the preferred method of checking to see if a result set is > empty in a view? For instance, I'm writing blog software and have a

Empty Result set

2008-05-06 Thread jwwest
What's the preferred method of checking to see if a result set is empty in a view? For instance, I'm writing blog software and have a view by year method. If there are no posts, I want to raise a http404. I've tried == {} and == [] to no avail. Thanks, - James --~--~-~--~~--