|
|
|
|
@ -1,4 +1,3 @@ |
|
|
|
|
from random import shuffle |
|
|
|
|
from paymentwall import Pingback |
|
|
|
|
|
|
|
|
|
from django.contrib.auth import get_user_model |
|
|
|
|
@ -276,19 +275,7 @@ class CoursesView(ListView): |
|
|
|
|
context = super().get_context_data() |
|
|
|
|
filtered = CourseFilter(self.request.GET) |
|
|
|
|
context.update(filtered.data) |
|
|
|
|
# Иммитация order_by('?'), чтобы можно было использовать пагинацию |
|
|
|
|
# если что, сделать свой QuerySet для Course с методом, который возвращает такой список |
|
|
|
|
course_items = context.get('course_items') |
|
|
|
|
featured = [] |
|
|
|
|
other = [] |
|
|
|
|
for ci in course_items: |
|
|
|
|
if ci.is_featured: |
|
|
|
|
featured.append(ci) |
|
|
|
|
else: |
|
|
|
|
other.append(ci) |
|
|
|
|
shuffle(featured) |
|
|
|
|
shuffle(other) |
|
|
|
|
context['course_items'] = featured + other |
|
|
|
|
context['course_items'] = Course.shuffle(context.get('course_items')) |
|
|
|
|
return context |
|
|
|
|
|
|
|
|
|
def get_template_names(self): |
|
|
|
|
|