Fix index view

remotes/origin/hasaccess
Ivlev Denis 8 years ago
parent b857215d22
commit 0a02cc8367
  1. 14
      project/urls.py
  2. 16
      project/views.py

@ -24,13 +24,13 @@ from apps.course.views import (
lessoncomment, CourseEditView,
CourseOnModerationView,
)
from apps.course.models import Course
from apps.user.views import (
UserView, UserEditView, NotificationEditView,
PaymentHistoryView, resend_email_verify,
)
from apps.payment.views import CourseBuyView, PaymentwallCallbackView, SchoolBuyView
from apps.school.models import SchoolSchedule
from .views import IndexView
urlpatterns = [
path('admin/', admin.site.urls),
@ -61,15 +61,7 @@ urlpatterns = [
path('privacy', TemplateView.as_view(template_name="templates/lilcity/privacy_policy.html"), name='privacy'),
path('terms', TemplateView.as_view(template_name="templates/lilcity/terms.html"), name='terms'),
path('refund-policy', TemplateView.as_view(template_name="templates/lilcity/refund_policy.html"), name='refund_policy'),
path('',
TemplateView.as_view(
template_name="templates/lilcity/main.html",
extra_context={
'course_items': Course.objects.filter(status=Course.PUBLISHED)[:3],
'school_schedules': SchoolSchedule.objects.all(),
}),
name='index'
),
path('', IndexView.as_view(), name='index'),
path('api/v1/', include(('api.v1.urls', 'api_v1'))),
path('test', TemplateView.as_view(template_name="templates/lilcity/test.html"), name='test'),
]

@ -0,0 +1,16 @@
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
Loading…
Cancel
Save