from django.views.generic import TemplateView from apps.course.models import Course from apps.school.models import SchoolSchedule class IndexView(TemplateView): template_name = 'templates/lilcity/main.html' def get_context_data(self): context = super().get_context_data() context.update({ 'course_items': Course.objects.filter(status=Course.PUBLISHED)[:3], 'school_schedules': SchoolSchedule.objects.all(), }) return context