drulum/core/views.py

15 lines
414 B
Python

from django.views.generic import TemplateView
from articles.models import Article
class Homepage(TemplateView):
template_name = 'core/homepage.html'
def get_context_data(self, **kwargs):
context = super(Homepage, self).get_context_data()
context['featured_articles'] = Article.objects.filter(is_featured=True)
return context
# TODO: place a random website link on the homepage