|
|
|
|
@ -1,7 +1,7 @@ |
|
|
|
|
from django.contrib.auth.decorators import login_required |
|
|
|
|
from django.http import JsonResponse |
|
|
|
|
from django.template import loader |
|
|
|
|
from django.views.generic import View, ListView |
|
|
|
|
from django.views.generic import View, DetailView, ListView |
|
|
|
|
from django.views.decorators.csrf import csrf_exempt |
|
|
|
|
from django.views.decorators.http import require_http_methods |
|
|
|
|
from .models import Course, Like |
|
|
|
|
@ -37,6 +37,12 @@ def likes(request, course_id): |
|
|
|
|
}) |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
class CourseView(DetailView): |
|
|
|
|
model = Course |
|
|
|
|
context_object_name = 'course' |
|
|
|
|
template_name = 'course/course.html' |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
class CoursesView(ListView): |
|
|
|
|
model = Course |
|
|
|
|
context_object_name = 'course_items' |
|
|
|
|
|