Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.
def newsfeed(self):
# Get list of latest news
curlang = translation.get_language()
parent = BlogPage.objects.filter(slug='news-%s' % curlang)
if not parent: return []
entries = EntryPage.objects.live().descendant_of(parent[0])
# Order by most recent date first
entries = entries.order_by('-date')
return entries[:4]
def newsfeed(self):
# Get list of latest news
# TODO: fetch children of 'News (DE)'
entries = EntryPage.objects.live().descendant_of(self)
# Order by most recent date first
entries = entries.order_by('-date')
return entries[:4]
def get_context(self, request, *args, **kwargs):
entries = EntryPage.objects.live().order_by('-date')[0:3]
blog_page = BlogPage.objects.all().first()
context = super(HomePage, self).get_context(request, *args, **kwargs)
context['entries'] = entries
context['blog_page'] = blog_page
quotes = Quote.objects.all()
if quotes:
quote = random.choice(Quote.objects.all())
context['quote'] = quote
# user = request.user
# if user.is_authenticated and user.is_league_member:
# now = timezone.now()
# opponents = user.get_opponents()
# if opponents is False:
# context['should_join'] = True
# else:
# availables = AvailableEvent.objects.filter(