NASA-TEST
This commit is contained in:
16
main/views.py
Normal file
16
main/views.py
Normal file
@@ -0,0 +1,16 @@
|
||||
from django.shortcuts import render
|
||||
from django.views.generic import TemplateView
|
||||
from .models import SliderItem
|
||||
|
||||
class MainView(TemplateView):
|
||||
template_name = 'index.html'
|
||||
|
||||
def get_context_data(self, **kwargs):
|
||||
context = super().get_context_data(**kwargs)
|
||||
context['title'] = 'Главная страница'
|
||||
context['slider_items'] = SliderItem.objects.all()
|
||||
return context
|
||||
|
||||
def get(self, request, *args, **kwargs):
|
||||
context = self.get_context_data()
|
||||
return self.render_to_response(context)
|
||||
Reference in New Issue
Block a user