]> git.parisson.com Git - telemeta.git/commitdiff
add has_mediafile (sound) to all resources
authorGuillaume Pellerin <yomguy@parisson.com>
Mon, 30 Dec 2013 23:13:02 +0000 (00:13 +0100)
committerGuillaume Pellerin <yomguy@parisson.com>
Mon, 30 Dec 2013 23:13:02 +0000 (00:13 +0100)
telemeta/models/media.py
telemeta/templates/telemeta/inc/resource_list.html

index f3e9fbd42c322340472339daa936d17349845e21..2a7e27ca48b1802e73b35d48a344826138e0a6f4 100644 (file)
@@ -767,6 +767,13 @@ class MediaCorpus(MediaBaseResource):
     @property
     def public_id(self):
         return self.code
+    
+    @property
+    def has_mediafile(self):
+        for child in self.children.all():
+            if child.has_mediafile:
+                return True
+        return False
 
     class Meta(MetaCore):
         db_table = 'media_corpus'
@@ -789,6 +796,13 @@ class MediaFonds(MediaBaseResource):
     def public_id(self):
         return self.code
 
+    @property
+    def has_mediafile(self):
+        for child in self.children.all():
+            if child.has_mediafile:
+                return True
+        return False
+
     class Meta(MetaCore):
         db_table = 'media_fonds'
         verbose_name = _('fonds')
index 2f8c199e2ce2c4d586025f5786359d5fc87c53c1..25b066154de815a64ddfbe7fdfc806a86190e32d 100644 (file)
@@ -13,7 +13,7 @@
     <th class="highlight">{% trans "Title" %}</th>
     <th>{% trans "Description" %}</th>
     <th>{% trans "Code" %}</th>
-    <th>{% trans "Reference" %}</th>
+    <th>{% trans "Sound" %}</th>
 </tr>
 {% for resource in resources %}
 <tr {% if not forloop.counter0|divisibleby:"2" %}class="odd"{% endif %}>
     </td>
     <td>{{ resource.description }}</td>
     <td>{{ resource.code }}</td>
-    <td>{{ resource.reference }}</td>
+    <td>{% if resource.has_mediafile %}
+       <img src="{{ STATIC_URL }}telemeta/images/ok.png" alt="yes" style="vertical-align:middle" />
+      {% endif %}
+    </td>
 </tr>
 {% endfor %}
 </table>