add is_downloadable field

This commit is contained in:
bkfox 2022-10-05 19:52:47 +02:00
parent 91707c4553
commit a24afd114e
2 changed files with 11 additions and 5 deletions

View File

@ -24,7 +24,8 @@ class SoundTrackInline(TrackInline):
class SoundInline(admin.TabularInline):
model = Sound
fields = ['type', 'name', 'audio', 'duration', 'is_good_quality', 'is_public']
fields = ['type', 'name', 'audio', 'duration', 'is_good_quality', 'is_public',
'is_downloadable']
readonly_fields = ['type', 'audio', 'duration', 'is_good_quality']
extra = 0
max_num = 0
@ -42,14 +43,15 @@ class SoundAdmin(SortableAdminBase, admin.ModelAdmin):
fields = None
list_display = ['id', 'name', 'related',
'type', 'duration', 'is_public', 'is_good_quality',
'audio']
'is_downloadable', 'audio']
list_filter = ('type', 'is_good_quality', 'is_public')
list_editable = ['name', 'type', 'is_public']
list_editable = ['name', 'type', 'is_public', 'is_downloadable']
search_fields = ['name', 'program__title']
fieldsets = [
(None, {'fields': ['name', 'file', 'type', 'program', 'episode']}),
(None, {'fields': ['duration', 'is_public', 'is_good_quality', 'mtime']}),
(None, {'fields': ['duration', 'is_public', 'is_downloadable',
'is_good_quality', 'mtime']}),
]
readonly_fields = ('file', 'duration',)
inlines = [SoundTrackInline]

View File

@ -127,7 +127,11 @@ class Sound(models.Model):
blank=True, null=True
)
is_public = models.BooleanField(
_('public'), help_text=_('if it can be podcasted from the server'),
_('public'), help_text=_('whether it is publicly available as podcast'),
default=False,
)
is_downloadable = models.BooleanField(
_('downloadable'), help_text=_('whether it can be publicly downloaded by visitors'),
default=False,
)