define additional label for soundfile cells
authorFrédéric Péters <fpeters@0d.be>
Sun, 15 Mar 2015 15:14:16 +0000 (16:14 +0100)
committerFrédéric Péters <fpeters@0d.be>
Sun, 15 Mar 2015 15:14:16 +0000 (16:14 +0100)
panikombo/models.py

index 96021a0..656b2cf 100644 (file)
@@ -20,3 +20,17 @@ class SoundCell(CellBase):
     def get_default_form_class(self):
         from .forms import SoundCellForm
         return SoundCellForm
+
+    def get_additional_label(self):
+        if self.soundfile:
+            if self.soundfile.fragment:
+                return u'%s - %s - %s' % (
+                        self.soundfile.episode.emission.title,
+                        self.soundfile.episode.title,
+                        self.soundfile.title)
+            else:
+                return u'%s - %s' % (
+                        self.soundfile.episode.emission.title,
+                        self.soundfile.episode.title)
+
+        return ''