local changes from the server
[edumed.git] / catalogue / templatetags / catalogue_tags.py
index 5166298..eecf9dc 100755 (executable)
@@ -20,7 +20,8 @@ def catalogue_levels_main():
     c = object_list.count()
     return {
         'object_list': object_list,
-        'section_width': (700 - 20 * (c - 1)) / c,
+        #'section_width': (700 - 20 * (c - 1)) / c,
+        'section_width': (700 - 20 * 2) / 3
     }
 
 
@@ -34,7 +35,7 @@ def level_box(level):
     by_course = defaultdict(lambda: defaultdict(list))
 
     lesson_lists = [alist for alist in [
-        list(level.lesson_set.exclude(type='appendix').order_by('section__order')),
+        list(level.lesson_set.exclude(type='appendix').order_by('section__order', 'order')),
         list(level.lessonstub_set.all())
     ] if alist]
 
@@ -48,6 +49,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.startswith('added'): continue
         else:
             lessons[lesson.type].append(lesson)
 
@@ -58,10 +60,50 @@ 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',
+                ]
+            ],
+            })
+        added.append({
+            'slug': 'varsaviana',
+            'title': u'Edukacja varsavianistyczna',
+            'lessons': [
+                Lesson.objects.get(slug=s) for s in
+'''
+czego-prus-w-lalce-o-zydach-nie-powiedzial
+jak-zmienila-sie-warszawa-o-dworcu-dawniej-i-dzis
+o-gwarze-praskiej
+poznaj-i-pokaz-prage
+praga-trzech-religii
+sladami-zydow-w-warszawie
+tajemnice-palacu-saskiego
+warszawa-przedwojenne-miasto-neonow
+warszawski-barok
+ziemianska-jako-soczewka-swiata-lat-miedzywojennych
+'''.strip().split()
+            ],
+            })
+
+
     return {
         "level": level,
         "lessons": lessons,
         "courses": courses,
+        "added": added,
     }
 
 @register.inclusion_tag("catalogue/snippets/lesson_nav.html")
@@ -72,6 +114,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)