Hi,
You are catching a KeyError while it throws and IndexError ;)
Regards,
Xavier.
Le 20 sept. 2010 à 17:04, grimmus a écrit :
> Hi,
>
> On the homepage of my website i list 1 random ad in the right column.
> In my view i retrieve it like so:
>
> side_ad = SideAd.objects.filter(active=1).ord
Hi,
On the homepage of my website i list 1 random ad in the right column.
In my view i retrieve it like so:
side_ad = SideAd.objects.filter(active=1).order_by("?")[0]
If all ad's are inactive no object's will be returned thus creating an
IndexError : list out of range
I tried to wrap the above
2 matches
Mail list logo