how can i specify or determine the values in my objects in python if it has this value [] or it has [<Booking: arab>],
let us say that in my queryset, i filter a value that not exist in my objects.
here is what i have done : this date_select has no data
>>> x = Booking.objects.filter(date_select='2011-12-3')
>>> print x
[]
>>> if x == None:
... print 'none'
...
>>>
is it [] not equal to None?
when i try a date_select that has data
>>> x = Booking.objects.filter(date_select='2011-12-2')
>>> print x
[<Booking: arab>, <Booking: arab>, <Booking: vvv>]
>>> if x == None:
... print 'none'
...
>>>
i just want to determine if x has a data or not…
can anyone can give me an idea about my case?
thanks in advance
If you want to know if your queryset returned any results, call the
existsmethod.If you want to know how many items, you can use
count