diff --git a/apps/course/templates/course/_items.html b/apps/course/templates/course/_items.html index cfdd7fbe..4025ab78 100644 --- a/apps/course/templates/course/_items.html +++ b/apps/course/templates/course/_items.html @@ -1,5 +1,18 @@ {% load static %} -
+{% load data_liked from data_liked %} + +
Подробнее
@@ -14,14 +27,16 @@ {% endif %}
- {{ course.category | upper }} + {{ course.category | upper }} {% if not course.is_free %} -
{{ course.price|floatformat:"-2" }}$
{% endif %} +
{{ course.price|floatformat:"-2" }}$
+ {% endif %}
- {{ course.title }} + {{ course.title }}
{{ course.short_description }}
+ {% if course.author.photo %}
@@ -31,6 +46,7 @@
{% endif %} +
{{ course.author.get_full_name }}
diff --git a/apps/course/templatetags/data_liked.py b/apps/course/templatetags/data_liked.py new file mode 100644 index 00000000..c8aa4354 --- /dev/null +++ b/apps/course/templatetags/data_liked.py @@ -0,0 +1,13 @@ +from django import template + +from ..models import Like + +register = template.Library() + + +@register.simple_tag +def data_liked(user, course): + for like in course.likes.all(): + if user == like.user: + return True + return False diff --git a/project/templates/lilcity/index.html b/project/templates/lilcity/index.html index b296d743..be860361 100644 --- a/project/templates/lilcity/index.html +++ b/project/templates/lilcity/index.html @@ -127,7 +127,7 @@ {% if user.photo %}
{% else %} -
+
{% endif %}
{% comment %} 234.120.345 руб. {% endcomment %}