diff --git a/apps/course/filters.py b/apps/course/filters.py index 827079e6..6e4e873e 100644 --- a/apps/course/filters.py +++ b/apps/course/filters.py @@ -4,7 +4,7 @@ from .models import Course class CourseFilter(django_filters.FilterSet): - category = django_filters.CharFilter(field_name='category__title', lookup_expr='iexact') + category = django_filters.CharFilter(field_name='category') class Meta: model = Course diff --git a/apps/course/templates/course/courses.html b/apps/course/templates/course/courses.html index a3277174..8f6f57d2 100644 --- a/apps/course/templates/course/courses.html +++ b/apps/course/templates/course/courses.html @@ -20,8 +20,8 @@
-
-
{% if category %}{{ category.0 }}{% else %}Категории{% endif %}
+
+
Категории
diff --git a/apps/course/templates/course/inclusion/category_items.html b/apps/course/templates/course/inclusion/category_items.html index 5e6aeef5..8dd8a0e9 100644 --- a/apps/course/templates/course/inclusion/category_items.html +++ b/apps/course/templates/course/inclusion/category_items.html @@ -1,5 +1,6 @@ {% for cat in category_items %} -
+
{{ cat.title }}
{% endfor %} \ No newline at end of file diff --git a/apps/course/templatetags/lilcity_category.py b/apps/course/templatetags/lilcity_category.py index 957e50c2..f4596935 100644 --- a/apps/course/templatetags/lilcity_category.py +++ b/apps/course/templatetags/lilcity_category.py @@ -9,7 +9,7 @@ register = template.Library() def category_items(category=None): return { 'category_items': Category.objects.filter(courses__status=Course.PUBLISHED).exclude(courses=None).distinct(), - 'category': category, + 'category': int(category[0]) if category and category[0] else None, } diff --git a/web/src/js/modules/courses.js b/web/src/js/modules/courses.js index 2581df46..1353ae43 100644 --- a/web/src/js/modules/courses.js +++ b/web/src/js/modules/courses.js @@ -12,6 +12,10 @@ moment.locale('ru'); const history = createHistory(); $(document).ready(function () { + const currentCategory = $('div.js-select-option.active[data-category-option]').attr('data-category-name'); + if(currentCategory) { + $('.js-select[data-category-select] .js-select-head').text(currentCategory); + } // Обработчик отложенных курсов setInterval(() => { $('div[data-future-course]').each((_, element) => { @@ -129,4 +133,4 @@ function load_courses(coursesUrl, fromStart) { buttonElement.removeClass('loading'); } }); -} \ No newline at end of file +}