i have a problem in determining an object if it is empty or not... here is my code :
this value has no data
>>> x = Booking.objects.filter(date_select='2011-12-3')
>>> print x
[]
>>> if x == None:
... print 'none'
...
>>>
this has a data :
>>> x = Booking.objects.filter(date_select='2011-12-2')
>>> print x
[<Booking: arab>, <Booking: arab>, <Booking: vvv>]
>>> if x == None:
... print 'none'
...
>>>
I have learned that []
is not equal to None
from my prev question...
Here is the algorithm that i want to apply in my code:
if x has an empty queryset
print empy
else
print data
can anyone can help me about it? thanks...