forked from rc/aircox
remove Station model (to much trouble for few advantages); start new player; rename Post.detail_url to Post.url, same for ListItem; move Article into website app; add website.Sound post; work on lists;...
This commit is contained in:
@ -24,6 +24,8 @@ class StreamInline(admin.TabularInline):
|
||||
model = Stream
|
||||
extra = 1
|
||||
|
||||
class SoundDiffInline(admin.TabularInline):
|
||||
model = Diffusion.sounds.through
|
||||
|
||||
# from suit.admin import SortableTabularInline, SortableModelAdmin
|
||||
#class TrackInline(SortableTabularInline):
|
||||
@ -45,11 +47,11 @@ class NameableAdmin(admin.ModelAdmin):
|
||||
@admin.register(Sound)
|
||||
class SoundAdmin(NameableAdmin):
|
||||
fields = None
|
||||
list_display = ['id', 'name', 'duration', 'type', 'mtime', 'good_quality', 'removed', 'public']
|
||||
list_display = ['id', 'name', 'duration', 'type', 'mtime', 'good_quality', 'removed']
|
||||
fieldsets = [
|
||||
(None, { 'fields': NameableAdmin.fields + ['path', 'type'] } ),
|
||||
(None, { 'fields': ['embed', 'duration', 'mtime'] }),
|
||||
(None, { 'fields': ['removed', 'good_quality', 'public' ] } )
|
||||
(None, { 'fields': ['removed', 'good_quality' ] } )
|
||||
]
|
||||
readonly_fields = ('path', 'duration',)
|
||||
|
||||
@ -59,10 +61,6 @@ class StreamAdmin(admin.ModelAdmin):
|
||||
list_display = ('id', 'program', 'delay', 'begin', 'end')
|
||||
|
||||
|
||||
@admin.register(Station)
|
||||
class StationAdmin(NameableAdmin):
|
||||
fields = NameableAdmin.fields + [ 'active', 'public', 'fallback' ]
|
||||
|
||||
@admin.register(Program)
|
||||
class ProgramAdmin(NameableAdmin):
|
||||
def schedule(self, obj):
|
||||
@ -113,8 +111,9 @@ class DiffusionAdmin(admin.ModelAdmin):
|
||||
list_editable = ('type',)
|
||||
ordering = ('-start', 'id')
|
||||
|
||||
fields = ['type', 'start', 'end', 'initial', 'program', 'sounds']
|
||||
inlines = [ DiffusionInline ]
|
||||
fields = ['type', 'start', 'end', 'initial', 'program']
|
||||
inlines = [ DiffusionInline, SoundDiffInline ]
|
||||
exclude = ('sounds',)
|
||||
|
||||
|
||||
def get_form(self, request, obj=None, **kwargs):
|
||||
|
@ -141,11 +141,6 @@ class Sound(Nameable):
|
||||
default = False,
|
||||
help_text = _('sound\'s quality is okay')
|
||||
)
|
||||
public = models.BooleanField(
|
||||
_('public'),
|
||||
default = False,
|
||||
help_text = _('sound\'s is accessible through the website')
|
||||
)
|
||||
|
||||
def get_mtime(self):
|
||||
"""
|
||||
@ -417,32 +412,6 @@ class Schedule(models.Model):
|
||||
verbose_name_plural = _('Schedules')
|
||||
|
||||
|
||||
class Station(Nameable):
|
||||
"""
|
||||
A Station regroup one or more programs (stream and normal), and is the top
|
||||
element used to generate streams outputs and configuration.
|
||||
"""
|
||||
active = models.BooleanField(
|
||||
_('active'),
|
||||
default = True,
|
||||
help_text = _('this station is active')
|
||||
)
|
||||
public = models.BooleanField(
|
||||
_('public'),
|
||||
default = True,
|
||||
help_text = _('information are available to the public'),
|
||||
)
|
||||
fallback = models.FilePathField(
|
||||
_('fallback song'),
|
||||
match = r'(' + '|'.join(settings.AIRCOX_SOUND_FILE_EXT) \
|
||||
.replace('.', r'\.') + ')$',
|
||||
recursive = True,
|
||||
blank = True, null = True,
|
||||
help_text = _('use this song file if there is a problem and nothing is '
|
||||
'played')
|
||||
)
|
||||
|
||||
|
||||
class Program(Nameable):
|
||||
"""
|
||||
A Program can either be a Streamed or a Scheduled program.
|
||||
@ -456,10 +425,6 @@ class Program(Nameable):
|
||||
Renaming a Program rename the corresponding directory to matches the new
|
||||
name if it does not exists.
|
||||
"""
|
||||
station = models.ForeignKey(
|
||||
Station,
|
||||
verbose_name = _('station')
|
||||
)
|
||||
active = models.BooleanField(
|
||||
_('active'),
|
||||
default = True,
|
||||
@ -621,7 +586,7 @@ class Diffusion(models.Model):
|
||||
return r
|
||||
|
||||
@classmethod
|
||||
def get(cl, station = None, date = None,
|
||||
def get(cl, date = None,
|
||||
now = False, next = False, prev = False,
|
||||
queryset = None,
|
||||
**filter_args):
|
||||
@ -637,9 +602,6 @@ class Diffusion(models.Model):
|
||||
"""
|
||||
#FIXME: conflicts? ( + calling functions)
|
||||
date = date_or_default(date)
|
||||
if station:
|
||||
filter_args['program__station'] = station
|
||||
|
||||
if queryset is None:
|
||||
queryset = cl.objects
|
||||
|
||||
|
Reference in New Issue
Block a user