X-Git-Url: https://git.mdrn.pl/edumed.git/blobdiff_plain/6c7e3b7d082affb3d779049d5311eb5775de65dd..0b7c6a7b88888fe948faa33edc988ba10d62b7c5:/catalogue/templatetags/catalogue_tags.py diff --git a/catalogue/templatetags/catalogue_tags.py b/catalogue/templatetags/catalogue_tags.py index 7003dfe..4485e18 100755 --- a/catalogue/templatetags/catalogue_tags.py +++ b/catalogue/templatetags/catalogue_tags.py @@ -24,7 +24,16 @@ def catalogue_section_buttons(): @register.inclusion_tag("catalogue/snippets/section_box.html") def section_box(section): lessons = SortedDict() - for lesson in section.lesson_set.all(): + lesson_lists = [alist for alist in [ + list(section.lesson_set.all()), + list(section.lessonstub_set.all()) + ] if alist] + while lesson_lists: + min_index, min_list = min(enumerate(lesson_lists), key=lambda x: x[1][0].order) + lesson = min_list.pop(0) + if not min_list: + lesson_lists.pop(min_index) + if lesson.level not in lessons: newdict = SortedDict() newdict['synthetic'] = [] @@ -40,7 +49,7 @@ def section_box(section): @register.inclusion_tag("catalogue/snippets/lesson_nav.html") def lesson_nav(lesson): - if lesson.type == 'course': + if lesson.type in ('course', 'project'): root = lesson.section siblings = Lesson.objects.filter(type='course', level=lesson.level, section=root) mark_level = False