crash-- when loading random quotes when there are no quotes
This commit is contained in:
@@ -1,5 +1,7 @@
|
||||
import models
|
||||
|
||||
def random_quote(request):
|
||||
quote = models.Quote.objects.order_by('?')[0]
|
||||
return {'quote': quote}
|
||||
quote = models.Quote.objects.order_by('?')
|
||||
if len(quote) > 0:
|
||||
return {'quote': quote[0]}
|
||||
return {}
|
||||
|
Reference in New Issue
Block a user