test delay + update template
This commit is contained in:
		@ -87,9 +87,9 @@ class Command (BaseCommand):
 | 
			
		||||
    @staticmethod
 | 
			
		||||
    def __render_stream_in_radio (stream):
 | 
			
		||||
        if stream.time_start and stream.time_end:
 | 
			
		||||
            data = '({{{}h-{}h}}, {})'.format(
 | 
			
		||||
                stream.time_start.hour,
 | 
			
		||||
                stream.time_end.hour,
 | 
			
		||||
            data = '({{{}-{}}}, {})'.format(
 | 
			
		||||
                stream.time_start.strftime('%Hh%M'),
 | 
			
		||||
                stream.time_end.strftime('%Hh%M'),
 | 
			
		||||
                stream.program.get_slug_name()
 | 
			
		||||
            )
 | 
			
		||||
        else:
 | 
			
		||||
@ -97,7 +97,7 @@ class Command (BaseCommand):
 | 
			
		||||
 | 
			
		||||
        if stream.delay:
 | 
			
		||||
            data = 'delay({}., {})'.format(
 | 
			
		||||
                    stream.delay.strftime('%s'),
 | 
			
		||||
                    3600*stream.delay.hour+60*stream.delay.minute+stream.delay.second,
 | 
			
		||||
                    data
 | 
			
		||||
                )
 | 
			
		||||
        return data
 | 
			
		||||
 | 
			
		||||
@ -6,7 +6,7 @@ def ensure (key, default):
 | 
			
		||||
 | 
			
		||||
 | 
			
		||||
# dict of values to set (do not forget to escape chars)
 | 
			
		||||
ensure('AIRCOX_LIQUIDSOAP_CONFIG', {
 | 
			
		||||
ensure('AIRCOX_LIQUIDSOAP_SET', {
 | 
			
		||||
    'log.file.path': '"/tmp/liquidsoap.log"',
 | 
			
		||||
    'server.socket': 'true',
 | 
			
		||||
    'server.socket.path': '"/tmp/liquidsoap.sock"'
 | 
			
		||||
 | 
			
		||||
@ -23,11 +23,15 @@ class ScheduleInline (admin.TabularInline):
 | 
			
		||||
    model = Schedule
 | 
			
		||||
    extra = 1
 | 
			
		||||
 | 
			
		||||
class StreamInline (admin.TabularInline):
 | 
			
		||||
    fields = ['delay', 'time_start', 'time_end']
 | 
			
		||||
    model = Stream
 | 
			
		||||
    extra = 1
 | 
			
		||||
 | 
			
		||||
 | 
			
		||||
class DiffusionInline (admin.TabularInline):
 | 
			
		||||
    model = Diffusion
 | 
			
		||||
    fields = ('episode', 'type', 'date')
 | 
			
		||||
    readonly_fields = ('date',)
 | 
			
		||||
    extra = 1
 | 
			
		||||
 | 
			
		||||
 | 
			
		||||
@ -66,8 +70,16 @@ class StreamAdmin (admin.ModelAdmin):
 | 
			
		||||
@admin.register(Program)
 | 
			
		||||
class ProgramAdmin (NameableAdmin):
 | 
			
		||||
    fields = NameableAdmin.fields
 | 
			
		||||
    inlines = [ ScheduleInline ]
 | 
			
		||||
    inlines = [ ScheduleInline, StreamInline ]
 | 
			
		||||
 | 
			
		||||
    def get_form (self, request, obj=None, **kwargs):
 | 
			
		||||
        if obj and Stream.objects.filter(program = obj).count() \
 | 
			
		||||
                and ScheduleInline in self.inlines:
 | 
			
		||||
            self.inlines.remove(ScheduleInline)
 | 
			
		||||
        elif obj and Schedule.objects.filter(program = obj).count() \
 | 
			
		||||
                and StreamInline in self.inlines:
 | 
			
		||||
            self.inlines.remove(StreamInline)
 | 
			
		||||
        return super().get_form(request, obj, **kwargs)
 | 
			
		||||
 | 
			
		||||
@admin.register(Episode)
 | 
			
		||||
class EpisodeAdmin (NameableAdmin):
 | 
			
		||||
 | 
			
		||||
		Reference in New Issue
	
	Block a user