mirror of
https://github.com/postgres/pgweb.git
synced 2025-08-10 00:42:06 +00:00
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:
@ -38,7 +38,8 @@ def home(request):
|
|||||||
try:
|
try:
|
||||||
quote = Quote.objects.filter(approved=True).order_by('?')[0]
|
quote = Quote.objects.filter(approved=True).order_by('?')[0]
|
||||||
except:
|
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)
|
versions = Version.objects.filter(supported=True)
|
||||||
planet = ImportedRSSItem.objects.filter(feed__internalname="planet").order_by("-posttime")[:5]
|
planet = ImportedRSSItem.objects.filter(feed__internalname="planet").order_by("-posttime")[:5]
|
||||||
|
|
||||||
|
Reference in New Issue
Block a user