W trybie naglym.
authorRadek Czajka <radekczajka@nowoczesnapolska.org.pl>
Fri, 28 Nov 2014 15:50:37 +0000 (16:50 +0100)
committerRadek Czajka <radekczajka@nowoczesnapolska.org.pl>
Fri, 28 Nov 2014 15:50:37 +0000 (16:50 +0100)
catalogue/management/commands/importlessons.py
catalogue/models.py
catalogue/templates/catalogue/snippets/lesson_nav.html
catalogue/templates/catalogue/snippets/level_box.html
catalogue/templates/catalogue/snippets/levels_main.html
catalogue/templatetags/catalogue_tags.py

index 83bf68b..3bd05ad 100755 (executable)
@@ -46,8 +46,8 @@ class Command(BaseCommand):
                     read_dir(fullname)
                 else:
                     f = IOFile.from_filename(fullname)
                     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
 
         read_dir(path)
         return files
index edb82f0..e291c42 100644 (file)
@@ -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"]
         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()
 
             u"Unknown lesson type: %s" % self.type
         self.save()
 
index d2bcf48..e3b21cf 100755 (executable)
@@ -5,6 +5,8 @@
     <a href="{% url 'catalogue_lessons' %}">Kurs skrócony, <br>{{ lesson.level }}</a>
 {% elif lesson.type == 'project' %}
     <a href="{% url 'catalogue_lessons' %}">Projekty, <br>{{ lesson.level }}</a>
     <a href="{% url 'catalogue_lessons' %}">Kurs skrócony, <br>{{ lesson.level }}</a>
 {% elif lesson.type == 'project' %}
     <a href="{% url 'catalogue_lessons' %}">Projekty, <br>{{ lesson.level }}</a>
+{% elif lesson.type == 'added' %}
+    <a href="{% url 'catalogue_lessons' %}#liceum_filmowa">Edukacja filmowa</a>
 {% else %}
     <a href="{% url 'catalogue_lessons' %}">Inne</a>
 {% endif %}
 {% else %}
     <a href="{% url 'catalogue_lessons' %}">Inne</a>
 {% endif %}
index e51be2a..3155cce 100755 (executable)
                 </ul>
             </li>
             {% endif %}
                 </ul>
             </li>
             {% endif %}
+
+            {% if added %}
+            <li class="curriculumcourses"><a href="#{{ level.slug }}_inne">Inne</a>
+                <ul style="list-style: none; padding: 0 0 0 1em; margin: 0;">
+                {% for item in added %}
+                    <li><a href="#{{ level.slug }}_{{ item.slug }}">{{ item.title }}</a></li>
+                {% endfor %}
+                </ul>
+            </li>
+            {% endif %}
+
         </ul>
         </ul>
+
+
     </section>
 
 
     </section>
 
 
+
     <h1>{{ level }}</h1>
 
     <section class="box-button button"><a href="{{ level.package.url }}" class="dl-button">Pobierz wszystkie lekcje</a></section>
     <h1>{{ level }}</h1>
 
     <section class="box-button button"><a href="{{ level.package.url }}" class="dl-button">Pobierz wszystkie lekcje</a></section>
     </section>
     {% endif %}
 
     </section>
     {% endif %}
 
+
+    {% if added %}
+    <section id="{{ level.slug }}_inne">
+        <h1>Inne</h1>
+
+        {% for item in added %}
+        <section id="{{ level.slug }}_{{ item.slug }}">
+            <h1>{{ item.title }}</h1>
+
+            <ul class="link-list">
+                {% for lesson in item.lessons %}
+                    <li><a href="{{ lesson.get_absolute_url }}" title="{{ lesson.description }}">{{ lesson }}</a></li>
+                {% endfor %}
+            </ul>
+        </section>
+        {% endfor %}
+    </section>
+    {% endif %}
+
+
 </section>
 </section>
index 497a5c8..97c5033 100644 (file)
     </a>
 </li>
 {% endfor %}
     </a>
 </li>
 {% endfor %}
+<li class="box6">
+    <a href="{{ les }}#liceum_filmowa">
+    <span class="in-box">
+    <span class="name">Edukacja filmowa</span>
+    8 godzin
+    </span>
+    </a>
+</li>
 </ul>
 </ul>
index 698b51b..8b05bf6 100755 (executable)
@@ -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)
             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)
 
         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()]
 
     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,
     return {
         "level": level,
         "lessons": lessons,
         "courses": courses,
+        "added": added,
     }
 
 @register.inclusion_tag("catalogue/snippets/lesson_nav.html")
     }
 
 @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 == '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)
     else:
         root = None
         siblings = Lesson.objects.filter(type=lesson.type, level=lesson.level)