How to use the puput.models.BlogPage.objects function in puput

To help you get started, we’ve selected a few puput examples, based on popular ways it is used in public projects.

Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.

github climu / openstudyroom / home / models.py View on Github external
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(
#                    end__gte=now,