File size: 859 Bytes
8f59bb3 | 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 | from django.views.generic import TemplateView, ListView
from blog.models import Post
class WelcomeView(ListView):
template_name = 'hydra/welcome.html'
def get_context_data(self, **kwargs):
context = super().get_context_data(**kwargs)
context['page'] = 'index'
return context
def get_queryset(self):
return Post.objects.all().order_by('-date')[:5]
class AboutView(TemplateView):
template_name = 'hydra/about.html'
def get_context_data(self, **kwargs):
context = super().get_context_data(**kwargs)
context['page'] = 'about'
return context
class ContactView(TemplateView):
template_name = 'hydra/online-presence.html'
def get_context_data(self, **kwargs):
context = super().get_context_data(**kwargs)
context['page'] = 'contact'
return context
|