]> 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:32 +0000 (00:13 +0100)
telemeta/models/media.py
telemeta/templates/telemeta/inc/resource_list.html

index c7796f1e5c7ddb7d299fd1cd31fa6e02d039d048..9f7f75aba3787058cc17147ee2e3732a385b92cd 100644 (file)
@@ -775,6 +775,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'
@@ -797,6 +804,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>