add download link; update player and pages layout

This commit is contained in:
bkfox
2022-10-07 16:15:32 +02:00
parent a24afd114e
commit 156b0afcb9
16 changed files with 13000 additions and 145 deletions

View File

@ -42,6 +42,10 @@ class SoundQuerySet(models.QuerySet):
""" Return sounds available as podcasts """
return self.filter(is_public=True)
def downloadable(self):
""" Return sounds available as podcasts """
return self.filter(is_downloadable=True)
def archive(self):
""" Return sounds that are archives """
return self.filter(type=Sound.TYPE_ARCHIVE)
@ -131,7 +135,8 @@ class Sound(models.Model):
default=False,
)
is_downloadable = models.BooleanField(
_('downloadable'), help_text=_('whether it can be publicly downloaded by visitors'),
_('downloadable'),
help_text=_('whether it can be publicly downloaded by visitors (sound must be public)'),
default=False,
)
@ -153,6 +158,8 @@ class Sound(models.Model):
self.program = self.episode.program
if check:
self.check_on_file()
if not self.is_public:
self.is_downloadable = False
self.__check_name()
super().save(*args, **kwargs)