fix modeladmin; Log.Type.on_air
This commit is contained in:
		@ -262,7 +262,7 @@ class Monitor:
 | 
			
		||||
            diff_ = Log.objects.station(self.station) \
 | 
			
		||||
                       .filter(diffusion = diff)
 | 
			
		||||
            if not diff_.count():
 | 
			
		||||
                self.log(type = Log.Type.live, source = source.id,
 | 
			
		||||
                self.log(type = Log.Type.on_air, source = source.id,
 | 
			
		||||
                         diffusion = diff, date = date)
 | 
			
		||||
            return
 | 
			
		||||
 | 
			
		||||
 | 
			
		||||
@ -1220,7 +1220,7 @@ class LogManager(models.Manager):
 | 
			
		||||
        * kwargs: extra filter kwargs
 | 
			
		||||
        """
 | 
			
		||||
        if include_live:
 | 
			
		||||
            qs = self.filter(type__in = (Log.Type.play, Log.Type.live),
 | 
			
		||||
            qs = self.filter(type__in = (Log.Type.play, Log.Type.on_air),
 | 
			
		||||
                             **kwargs)
 | 
			
		||||
        else:
 | 
			
		||||
            qs = self.filter(type = Log.Type.play, **kwargs)
 | 
			
		||||
@ -1255,7 +1255,7 @@ class Log(models.Model):
 | 
			
		||||
        """
 | 
			
		||||
        Source starts to be preload related_object
 | 
			
		||||
        """
 | 
			
		||||
        live = 0x03
 | 
			
		||||
        on_air = 0x03
 | 
			
		||||
        """
 | 
			
		||||
        A diffusion occured, but in live (no sound played by Aircox)
 | 
			
		||||
        """
 | 
			
		||||
@ -1266,7 +1266,7 @@ class Log(models.Model):
 | 
			
		||||
 | 
			
		||||
    type = models.SmallIntegerField(
 | 
			
		||||
        verbose_name = _('type'),
 | 
			
		||||
        choices = [ (int(y), _(x)) for x,y in Type.__members__.items() ],
 | 
			
		||||
        choices = [ (int(y), _(x.replace('_',' '))) for x,y in Type.__members__.items() ],
 | 
			
		||||
        blank = True, null = True,
 | 
			
		||||
    )
 | 
			
		||||
    station = models.ForeignKey(
 | 
			
		||||
 | 
			
		||||
@ -127,8 +127,8 @@ class LogAdmin(ModelAdmin):
 | 
			
		||||
    menu_label = _('Logs')
 | 
			
		||||
    menu_icon = 'time'
 | 
			
		||||
    menu_order = 300
 | 
			
		||||
    list_display = ['date', 'station', 'source', 'type', 'comment', 'related']
 | 
			
		||||
    list_filter = ['date', 'source', 'related_type']
 | 
			
		||||
    list_display = ['id', 'date', 'station', 'source', 'type', 'comment', 'diffusion', 'sound', 'track']
 | 
			
		||||
    list_filter = ['date', 'source', 'diffusion', 'sound', 'track']
 | 
			
		||||
 | 
			
		||||
aircox.models.Log.panels = [
 | 
			
		||||
    MultiFieldPanel([
 | 
			
		||||
@ -139,11 +139,12 @@ aircox.models.Log.panels = [
 | 
			
		||||
        ]),
 | 
			
		||||
        FieldPanel('type'),
 | 
			
		||||
        FieldPanel('comment'),
 | 
			
		||||
        FieldRowPanel([
 | 
			
		||||
            FieldPanel('related_type'),
 | 
			
		||||
            FieldPanel('related_id')
 | 
			
		||||
        ]),
 | 
			
		||||
    ], heading = _('Log')),
 | 
			
		||||
    MultiFieldPanel([
 | 
			
		||||
        FieldPanel('diffusion'),
 | 
			
		||||
        FieldPanel('sound'),
 | 
			
		||||
        FieldPanel('track'),
 | 
			
		||||
    ], heading = _('Related objects')),
 | 
			
		||||
]
 | 
			
		||||
 | 
			
		||||
 | 
			
		||||
 | 
			
		||||
		Reference in New Issue
	
	Block a user