Commit aecdfc32 authored by fred's avatar fred
Browse files

add main_sound property, to get the main sound of an episode (#1079)

parent 63f6a2c1
......@@ -181,6 +181,12 @@ class Episode(models.Model):
def has_sound(self):
return (self.soundfile_set.count() > 0)
def main_sound(self, podcastable=True):
t = self.soundfile_set.exclude(podcastable=False).exclude(fragment=True)
if t:
return t[0]
return None
class Diffusion(models.Model):
episode = models.ForeignKey('Episode', verbose_name=u'Episode')
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment