diff --git a/apps/course/models.py b/apps/course/models.py index 1245735f..2c3b1102 100644 --- a/apps/course/models.py +++ b/apps/course/models.py @@ -1,6 +1,8 @@ from django.db import models from django.utils import timezone +from .manager import CategoryQuerySet + class Course(models.Model): title = models.CharField("Название курса", max_length=100) @@ -36,5 +38,7 @@ class Course(models.Model): class Category(models.Model): title = models.CharField("Название категории", max_length=100) + manager = CategoryQuerySet.as_manager() + def __str__(self): return self.title diff --git a/apps/course/templates/course/inclusion/category_items.html b/apps/course/templates/course/inclusion/category_items.html new file mode 100644 index 00000000..ec8397d9 --- /dev/null +++ b/apps/course/templates/course/inclusion/category_items.html @@ -0,0 +1,5 @@ +{% for category in category_items %} +
+
{{ category.title }}
+
+{% endfor %} \ No newline at end of file diff --git a/apps/course/templatetags/__init__.py b/apps/course/templatetags/__init__.py new file mode 100644 index 00000000..e69de29b diff --git a/apps/course/templatetags/lilcity_category.py b/apps/course/templatetags/lilcity_category.py new file mode 100644 index 00000000..1d8666c6 --- /dev/null +++ b/apps/course/templatetags/lilcity_category.py @@ -0,0 +1,11 @@ +from django import template + +from ..models import Category + + +register = template.Library() + + +@register.inclusion_tag('course/inclusion/category_items.html') +def category_items(): + return {"category_items": Category.manager.all()} diff --git a/project/templates/lilcity/courses.html b/project/templates/lilcity/courses.html index aa83ea58..cfd15110 100644 --- a/project/templates/lilcity/courses.html +++ b/project/templates/lilcity/courses.html @@ -1,5 +1,6 @@ {% extends "templates/lilcity/index.html" %} {% load static %} +{% load category_items from lilcity_category %} {% block content %}
@@ -21,33 +22,7 @@
Категории
-
-
Персонаж
-
-
-
Акварель
-
-
-
Иллюстрация
-
-
-
Анимация
-
-
-
Пастель
-
-
-
Пластилин
-
-
-
Креативное мышление
-
-
-
Моторика
-
-
-
Живопись
-
+ {% category_items %}