fix modeladmin; Log.Type.on_air

This commit is contained in:
bkfox 2017-06-30 14:18:21 +02:00
parent 60cbf18942
commit e6639ba9ad
3 changed files with 11 additions and 10 deletions

View File

@ -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

View File

@ -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(

View File

@ -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')),
]