def home(request):
news = NewsArticle.objects.filter(approved=True)[:5]
events = Event.objects.select_related('country').filter(approved=True, training=False, enddate__gt=date.today).order_by('enddate', 'startdate')[:3]
- quote = Quote.objects.filter(approved=True).order_by('?')[0]
+ try:
+ quote = Quote.objects.filter(approved=True).order_by('?')[0]
+ except:
+ pass # if there is no quote available, just ignore error
versions = Version.objects.all()
planet = ImportedRSSItem.objects.filter(feed__internalname="planet").order_by("-posttime")[:5]