]> git.parisson.com Git - teleforma.git/commitdiff
fix types for media and conferences
authoryomguy <yomguy@parisson.com>
Tue, 5 Jun 2012 21:28:08 +0000 (23:28 +0200)
committeryomguy <yomguy@parisson.com>
Tue, 5 Jun 2012 21:28:08 +0000 (23:28 +0200)
teleforma/models.py
teleforma/templates/teleforma/course_detail.html
teleforma/templates/teleforma/course_media.html
teleforma/templates/teleforma/courses.html
teleforma/templates/teleforma/inc/conference_list.html
teleforma/templates/teleforma/inc/media_list.html
teleforma/views.py

index c8124816814ddd66e51e7b4ca7f5c7f5f46ee3c6..9ddfed3c38d0377d7637fc86c81fc38baae613ed 100755 (executable)
@@ -194,7 +194,7 @@ class Conference(Model):
 
     @property
     def description(self):
-        return ' - '.join([self.course.department.name, self.course.title, self.course.type.name,
+        return ' - '.join([self.course.department.name, self.course.title, self.course_type.name,
                            self.session, self.professor.user.first_name, self.professor.user.last_name,
                            str(self.date_begin)])
 
index 42a576cebb7a96c49f28aed757d0ca8d2dd47855..af9c80a5b6d7c3a000b43cd3153b7fcf2ff8be86 100644 (file)
@@ -30,27 +30,21 @@ $(document).ready(function(){
         </div>
 
         {% block document %}
-        {% with course as course and type as type %}
-        {% include "teleforma/inc/document_list.html" %}
-        {% endwith %}
+         {% include "teleforma/inc/document_list.html" %}
         {% endblock %}
 
         {% block conference %}
-        {% with course as course  %}
-        {% include "teleforma/inc/conference_list.html" %}
-        {% endwith %}
+         {% include "teleforma/inc/conference_list.html" %}
         {% endblock %}
 
         {% block media %}
-        {% with course as course %}
-        {% include "teleforma/inc/media_list.html" %}
-        {% endwith %}
+         {% include "teleforma/inc/media_list.html" %}
         {% endblock %}
 
         </div>
-{% endfor %}
-{% endfor %}
-{% endfor %}
+      {% endfor %}
+     {% endfor %}
+    {% endfor %}
 </div>
 {% endblock course %}
 
index 6fadc413d60f3ee664db6ac3fe34f3b03b6f1874..770cae42fb27ca3c115b604da40589465fbd08d9 100644 (file)
@@ -22,7 +22,7 @@ $(document).ready(function(){
 {% block course %}
 <div class="course_media">
 
-<div class="course_title">{{ course.title }}{% if course.description %} - {{ course.description }}{% endif %}{% if media.item %} - {{ media.item }}{% endif %}
+<div class="course_title">{{ course.title }} - {{ type }}{% if course.description %} - {{ course.description }}{% endif %}{% if media.item %} - {{ media.item }}{% endif %}
 </div>
 
 <div class="media">
index f49e0b8f6c80cd1e8c0a0704edbbcc09f9a093d1..043a446e53f7f58e9eb89f22e66f87780939ba9c 100644 (file)
@@ -62,22 +62,15 @@ $(document).ready(function(){
         </div>
 
         {% block document %}
-        {% with course as course and type as type %}
-        {% include "teleforma/inc/document_list.html" %}
-        {% endwith %}
+         {% include "teleforma/inc/document_list.html" %}
         {% endblock %}
 
-
         {% block conference %}
-        {% with course as course %}
-        {% include "teleforma/inc/conference_list.html" %}
-        {% endwith %}
+         {% include "teleforma/inc/conference_list.html" %}
         {% endblock %}
 
         {% block media %}
-        {% with course as course %}
-        {% include "teleforma/inc/media_list.html" %}
-        {% endwith %}
+         {% include "teleforma/inc/media_list.html" %}
         {% endblock %}
 
       </div>
index 9603671062d1899d64e5cfc2d91a5cfcc085951b..1cd0609b5c70dc0eed2e147d623533575b0c80f6 100644 (file)
@@ -1,6 +1,7 @@
+{% load telemeta_utils %}
 {% load i18n %}
 
-{% if course.conference.all %}
+{% if course.conference.all|from_type:type %}
 <div class="course_content">
 <div class="course_subtitle">
     <h3><img src="{% url telemeta-images "item_title.png" %}" style="vertical-align:middle" /> {% trans "Live conference"%}</h3>
@@ -17,9 +18,9 @@
         </tr>
     </thead>
     <tbody>
-        {% for conference in course.conference.all %}
+        {% for conference in course.conference.all|from_type:type %}
             <tr {% if not forloop.counter0|divisibleby:"2" %}class="odd"{% endif %}>
-            <td><a href="{% url teleforma-conference-detail conference.id %}">{{ conference.course.type }}</a></td>
+            <td><a href="{% url teleforma-conference-detail conference.id %}">{{ conference.course_type }}</a></td>
             <td><a href="{% url teleforma-conference-detail conference.id %}">{{ conference.room }}</a></td>
             <td><a href="{% url teleforma-conference-detail conference.id %}">{{ conference.session }}</a></td>
             <td><a href="{% url telemeta-profile-detail conference.professor.user.username %}" target="_blank">{{ conference.professor }}</a></td>
index 37fade82b7df0bebe1d62b0a326ae8ab5add62b0..76e0b82aacc1814c5948683057e25c121505575b 100644 (file)
@@ -1,6 +1,7 @@
+{% load telemeta_utils %}
 {% load i18n %}
 
-{% if course.media.all %}
+{% if course.media.all|from_type:type %}
 <div class="course_content">
 <div class="course_subtitle">
     <h3><img src="{% url telemeta-images "item_title.png" %}" style="vertical-align:middle" /> {% trans "Passed conferences"%}</h3>
@@ -14,7 +15,7 @@
         </tr>
     </thead>
     <tbody>
-        {% for media in course.media.all %}
+        {% for media in course.media.all|from_type:type %}
             <tr {% if not forloop.counter0|divisibleby:"2" %}class="odd"{% endif %}>
             <td><a href="{% url teleforma-media-detail media.id %}">{{ media.item.title }}</a></td>
             <td>{{ media.item.description }}</td>
index 9604e9d0bda10fceec6e8261efd7aabdafd4903c..bbb126565050ca9cd2634e3d77bc8abf29db7810 100755 (executable)
@@ -177,12 +177,13 @@ class MediaView(DetailView):
 
     def get_context_data(self, **kwargs):
         context = super(MediaView, self).get_context_data(**kwargs)
-        context['courses'] = get_courses(self.request.user)
+        context['all_courses'] = get_courses(self.request.user)
         media = self.get_object()
         view = ItemView()
         context['mime_type'] = view.item_analyze(media.item)
         context['course'] = media.course
         context['item'] = media.item
+        context['type'] = media.course_type
         context['notes'] = media.notes.all().filter(author=self.request.user)
         content_type = ContentType.objects.get(app_label="teleforma", model="media")
         context['room'] = get_room(name=media.item.title, content_type=content_type,
@@ -223,10 +224,11 @@ class ConferenceView(DetailView):
 
     def get_context_data(self, **kwargs):
         context = super(ConferenceView, self).get_context_data(**kwargs)
-        context['courses'] = get_courses(self.request.user)
+        context['all_courses'] = get_courses(self.request.user)
         conference = self.get_object()
         context['mime_type'] = 'video/webm'
         context['course'] = conference.course
+        context['type'] = conference.course_type
         context['notes'] = conference.notes.all().filter(author=self.request.user)
         content_type = ContentType.objects.get(app_label="teleforma", model="conference")
         context['room'] = get_room(name=conference.course.title, content_type=content_type,