From: Radek Czajka Date: Fri, 28 Nov 2014 15:50:37 +0000 (+0100) Subject: W trybie naglym. X-Git-Url: https://git.mdrn.pl/edumed.git/commitdiff_plain/e785f561e82f8230697ffe100139eb1270eb1311?ds=inline;hp=5d79e48732565dad23a8592eeebc8741972ef5cc W trybie naglym. --- diff --git a/catalogue/management/commands/importlessons.py b/catalogue/management/commands/importlessons.py index 83bf68b..3bd05ad 100755 --- a/catalogue/management/commands/importlessons.py +++ b/catalogue/management/commands/importlessons.py @@ -46,8 +46,8 @@ class Command(BaseCommand): read_dir(fullname) else: f = IOFile.from_filename(fullname) - files[name] = f - files.setdefault(name.replace(" ", ""), f) + files[name.decode('utf-8')] = f + files.setdefault(name.replace(" ", "").decode('utf-8'), f) read_dir(path) return files diff --git a/catalogue/models.py b/catalogue/models.py index edb82f0..e291c42 100644 --- a/catalogue/models.py +++ b/catalogue/models.py @@ -151,7 +151,7 @@ class Lesson(models.Model): wldoc = WLDocument.from_file(self.xml_file.path) self.dc = wldoc.book_info.to_dict() self.type = self.dc["type"] - assert self.type in ('appendix', 'course', 'synthetic', 'project'), \ + assert self.type in ('appendix', 'course', 'synthetic', 'project', 'added'), \ u"Unknown lesson type: %s" % self.type self.save() diff --git a/catalogue/templates/catalogue/snippets/lesson_nav.html b/catalogue/templates/catalogue/snippets/lesson_nav.html index d2bcf48..e3b21cf 100755 --- a/catalogue/templates/catalogue/snippets/lesson_nav.html +++ b/catalogue/templates/catalogue/snippets/lesson_nav.html @@ -5,6 +5,8 @@ Kurs skrócony,
{{ lesson.level }}
{% elif lesson.type == 'project' %} Projekty,
{{ lesson.level }}
+{% elif lesson.type == 'added' %} + Edukacja filmowa {% else %} Inne {% endif %} diff --git a/catalogue/templates/catalogue/snippets/level_box.html b/catalogue/templates/catalogue/snippets/level_box.html index e51be2a..3155cce 100755 --- a/catalogue/templates/catalogue/snippets/level_box.html +++ b/catalogue/templates/catalogue/snippets/level_box.html @@ -31,10 +31,24 @@ {% endif %} + + {% if added %} +
  • Inne + +
  • + {% endif %} + + + +

    {{ level }}

    Pobierz wszystkie lekcje
    @@ -139,4 +153,24 @@ {% endif %} + + {% if added %} +
    +

    Inne

    + + {% for item in added %} +
    +

    {{ item.title }}

    + + +
    + {% endfor %} +
    + {% endif %} + + diff --git a/catalogue/templates/catalogue/snippets/levels_main.html b/catalogue/templates/catalogue/snippets/levels_main.html index 497a5c8..97c5033 100644 --- a/catalogue/templates/catalogue/snippets/levels_main.html +++ b/catalogue/templates/catalogue/snippets/levels_main.html @@ -16,4 +16,12 @@ {% endfor %} +
  • + + + Edukacja filmowa + 8 godzin + + +
  • diff --git a/catalogue/templatetags/catalogue_tags.py b/catalogue/templatetags/catalogue_tags.py index 698b51b..8b05bf6 100755 --- a/catalogue/templatetags/catalogue_tags.py +++ b/catalogue/templatetags/catalogue_tags.py @@ -48,6 +48,7 @@ def level_box(level): if lesson.section not in lessons['course']: lessons['course'][lesson.section] = [] lessons['course'][lesson.section].append(lesson) + elif lesson.type == 'added': continue else: lessons[lesson.type].append(lesson) @@ -58,10 +59,30 @@ def level_box(level): courses = [(course, by_course[course]) for course in CurriculumCourse.objects.filter(lesson__level=level).distinct()] + added = [] + if level.slug == 'liceum': + added.append({ + 'slug': 'filmowa', + 'title': u'Edukacja filmowa', + 'lessons': [ + Lesson.objects.get(slug=s) for s in [ +'film-co-to-wlasciwie-jest', +'scenariusz-scenopis-i-srodki-realizacyjne', +'kompozycja-obrazu-filmowego', +'praca-kamery-kadr-kat', +'montaz-materialu-filmowego', +'swiatlo-i-dzwiek-w-filmie', +'scenografia-charakteryzacja-kostiumy-i-aktorzy', +'narracja-w-filmie-tekst-i-fabula', + ] + ], + }) + return { "level": level, "lessons": lessons, "courses": courses, + "added": added, } @register.inclusion_tag("catalogue/snippets/lesson_nav.html") @@ -72,6 +93,20 @@ def lesson_nav(lesson): elif lesson.type == 'appendix': root = None siblings = Lesson.objects.filter(type=lesson.type) + elif lesson.type == 'added': + root = None + siblings = [ + Lesson.objects.get(slug=s) for s in [ +'film-co-to-wlasciwie-jest', +'scenariusz-scenopis-i-srodki-realizacyjne', +'kompozycja-obrazu-filmowego', +'praca-kamery-kadr-kat', +'montaz-materialu-filmowego', +'swiatlo-i-dzwiek-w-filmie', +'scenografia-charakteryzacja-kostiumy-i-aktorzy', +'narracja-w-filmie-tekst-i-fabula', + ] + ] else: root = None siblings = Lesson.objects.filter(type=lesson.type, level=lesson.level)