Avoid crashing the frontpage when there are zero quotes

This won't happen in production since we don't delete quotes, but it
happens on empty dev environments. It still renders a pretty ugly
frontpage, but it doesn't crash...
This commit is contained in:
Magnus Hagander
2011-12-15 22:14:07 +01:00
parent a7606c6e8c
commit 8042d5a8bc

View File

@ -38,7 +38,8 @@ def home(request):
try:
quote = Quote.objects.filter(approved=True).order_by('?')[0]
except:
pass # if there is no quote available, just ignore error
# if there is no quote available, just ignore error
quote = None
versions = Version.objects.filter(supported=True)
planet = ImportedRSSItem.objects.filter(feed__internalname="planet").order_by("-posttime")[:5]