From 559656a1618f9287dae818db7895ddbc34198bc5 Mon Sep 17 00:00:00 2001 From: Ivlev Denis Date: Wed, 31 Jan 2018 11:21:43 +0300 Subject: [PATCH 1/5] LIL-153. Add link to author --- apps/course/templates/course/_items.html | 2 ++ 1 file changed, 2 insertions(+) diff --git a/apps/course/templates/course/_items.html b/apps/course/templates/course/_items.html index cfdd7fbe..717325b7 100644 --- a/apps/course/templates/course/_items.html +++ b/apps/course/templates/course/_items.html @@ -22,6 +22,7 @@
{{ course.short_description }}
+ {% if course.author.photo %}
@@ -31,6 +32,7 @@
{% endif %} +
{{ course.author.get_full_name }}
From fccc80036f0d44176e061a8a70a2d1c8ccaa90d3 Mon Sep 17 00:00:00 2001 From: Ivlev Denis Date: Wed, 31 Jan 2018 11:25:13 +0300 Subject: [PATCH 2/5] Add link to title of course --- apps/course/templates/course/_items.html | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/apps/course/templates/course/_items.html b/apps/course/templates/course/_items.html index 717325b7..70e8ea15 100644 --- a/apps/course/templates/course/_items.html +++ b/apps/course/templates/course/_items.html @@ -18,11 +18,11 @@ {% if not course.is_free %}
{{ course.price|floatformat:"-2" }}$
{% endif %}
- {{ course.title }} + {{ course.title }}
{{ course.short_description }}
- + {% if course.author.photo %}
From 2cd74254ae71e9002c4bc8c99134807695ff68f4 Mon Sep 17 00:00:00 2001 From: Ivlev Denis Date: Wed, 31 Jan 2018 11:26:57 +0300 Subject: [PATCH 3/5] Add link to category in course block --- apps/course/templates/course/_items.html | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/apps/course/templates/course/_items.html b/apps/course/templates/course/_items.html index 70e8ea15..3e00f238 100644 --- a/apps/course/templates/course/_items.html +++ b/apps/course/templates/course/_items.html @@ -14,7 +14,7 @@ {% endif %}
- {{ course.category | upper }} + {{ course.category | upper }} {% if not course.is_free %}
{{ course.price|floatformat:"-2" }}$
{% endif %}
From e1477eef6166852c4dcb68e6b65e831074468aef Mon Sep 17 00:00:00 2001 From: Ivlev Denis Date: Wed, 31 Jan 2018 11:43:45 +0300 Subject: [PATCH 4/5] Fix user dummy photo in nav bar --- project/templates/lilcity/index.html | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/project/templates/lilcity/index.html b/project/templates/lilcity/index.html index 444c783b..d40eb6f8 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 %} From 774934f00e12340ef8720499f40d5064f85aedc8 Mon Sep 17 00:00:00 2001 From: Ivlev Denis Date: Wed, 31 Jan 2018 13:00:55 +0300 Subject: [PATCH 5/5] LIL-123. Add data-liked attr for course item --- apps/course/templates/course/_items.html | 18 ++++++++++++++++-- apps/course/templatetags/data_liked.py | 13 +++++++++++++ 2 files changed, 29 insertions(+), 2 deletions(-) create mode 100644 apps/course/templatetags/data_liked.py diff --git a/apps/course/templates/course/_items.html b/apps/course/templates/course/_items.html index 3e00f238..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 %} + +
Подробнее
@@ -16,7 +29,8 @@
{{ course.category | upper }} {% if not course.is_free %} -
{{ course.price|floatformat:"-2" }}$
{% endif %} +
{{ course.price|floatformat:"-2" }}$
+ {% endif %}
{{ course.title }}
{{ course.short_description }} 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