From: Radek Czajka Date: Fri, 8 Feb 2013 12:42:42 +0000 (+0100) Subject: Add related lessons. X-Git-Url: https://git.mdrn.pl/edumed.git/commitdiff_plain/05333a6f2d2ea77a602612c3aaff039dc7b97200?ds=inline Add related lessons. --- diff --git a/catalogue/templates/catalogue/lesson_detail.html b/catalogue/templates/catalogue/lesson_detail.html index 6ccce2d..233c271 100755 --- a/catalogue/templates/catalogue/lesson_detail.html +++ b/catalogue/templates/catalogue/lesson_detail.html @@ -1,6 +1,6 @@ {% extends "base.html" %} {% load url from future %} -{% load lesson_nav person_list from catalogue_tags %} +{% load lesson_link lesson_nav person_list from catalogue_tags %} {% load competence curriculum url_for_level from curriculum_tags %} @@ -52,6 +52,17 @@ {% lesson_nav object %} + {% if object.dc.relations %} +
+

Powiązane lekcje

+ {% for uri in object.dc.relations %} + + {% endfor %} +
+ {% endif %} + {% if object.dc.competences %}

Kompetencje:

diff --git a/catalogue/templates/catalogue/snippets/lesson_link.html b/catalogue/templates/catalogue/snippets/lesson_link.html new file mode 100755 index 0000000..15b8cf0 --- /dev/null +++ b/catalogue/templates/catalogue/snippets/lesson_link.html @@ -0,0 +1 @@ +{{ lesson }} diff --git a/catalogue/templatetags/catalogue_tags.py b/catalogue/templatetags/catalogue_tags.py index 23ce402..80b1a0c 100755 --- a/catalogue/templatetags/catalogue_tags.py +++ b/catalogue/templatetags/catalogue_tags.py @@ -1,6 +1,7 @@ from django import template from django.utils.datastructures import SortedDict from ..models import Lesson, Section +from librarian.dcparser import WLURI, Person register = template.Library() @@ -51,9 +52,12 @@ def lesson_nav(lesson): "siblings": siblings, } +@register.inclusion_tag("catalogue/snippets/lesson_link.html") +def lesson_link(uri): + return {'lesson': Lesson.objects.get(slug=WLURI(uri).slug)} + @register.filter def person_list(persons): - from librarian.dcparser import Person return u", ".join(Person.from_text(p).readable() for p in persons)