small fixes and tests

This commit is contained in:
bkfox
2015-11-03 10:55:20 +01:00
parent 2039579061
commit 86bc9c1251
4 changed files with 27 additions and 27 deletions

View File

@ -80,7 +80,13 @@ class EpisodeAdmin (NameableAdmin):
@admin.register(Diffusion)
class DiffusionAdmin (admin.ModelAdmin):
list_display = ('id', 'type', 'date', 'episode', 'program', 'stream')
def archives (self, obj):
sounds = obj.episode and \
(os.path.basename(sound.path) for sound in obj.episode.sounds.all()
if sound.type == Sound.Type['archive'] )
return ', '.join(sounds) if sounds else ''
list_display = ('id', 'type', 'date', 'archives', 'episode', 'program', 'stream')
list_filter = ('type', 'date', 'program', 'stream')
list_editable = ('type', 'date')