fix bugs on signals

This commit is contained in:
bkfox
2016-11-14 13:35:15 +01:00
parent 45268cd699
commit b8d6c435d2
103 changed files with 47 additions and 32 deletions

0
aircox/README.md Normal file → Executable file
View File

View File

@ -81,7 +81,7 @@ class ProgramAdmin(NameableAdmin):
schedule.boolean = True
schedule.short_description = _("Schedule")
list_display = ('id', 'name', 'active', 'schedule', 'sync')
list_display = ('id', 'name', 'active', 'schedule', 'sync', 'station')
fields = NameableAdmin.fields + [ 'active', 'station','sync' ]
inlines = [ ScheduleInline, StreamInline ]

0
aircox/apps.py Normal file → Executable file
View File

0
aircox/connector.py Normal file → Executable file
View File

0
aircox/controllers.py Normal file → Executable file
View File

0
aircox/locale/fr/LC_MESSAGES/django.po Normal file → Executable file
View File

0
aircox/management/__init__.py Normal file → Executable file
View File

0
aircox/management/commands/__init__.py Normal file → Executable file
View File

0
aircox/management/commands/diffusions_monitor.py Normal file → Executable file
View File

0
aircox/management/commands/import_playlist.py Normal file → Executable file
View File

0
aircox/management/commands/sounds_monitor.py Normal file → Executable file
View File

0
aircox/management/commands/sounds_quality_check.py Normal file → Executable file
View File

0
aircox/management/commands/streamer.py Normal file → Executable file
View File

5
aircox/signals.py Normal file → Executable file
View File

@ -12,6 +12,7 @@ import aircox.utils as utils
@receiver(post_save, sender=models.Schedule)
def schedule_post_saved(sender, instance, created, *args, **kwargs):
# TODO: case instance.program has changed
if not instance.program.sync:
return
@ -19,8 +20,12 @@ def schedule_post_saved(sender, instance, created, *args, **kwargs):
if not initial or not instance.changed(['date','duration', 'frequency']):
return
if not initial.get('date') or not initial.get('duration') or not initial.get('frequency'):
return
# old schedule and timedelta
old_sched = models.Schedule(
program = instance.program,
date = initial['date'],
duration = initial['duration'],
frequency = initial['frequency'],

0
aircox/static/aircox/css/layout.css Normal file → Executable file
View File

0
aircox/templates/aircox/config/liquidsoap.liq Normal file → Executable file
View File

0
aircox/templates/aircox/controllers/base_site.html Normal file → Executable file
View File

0
aircox/templates/aircox/controllers/monitor.html Normal file → Executable file
View File

20
aircox/templates/aircox/controllers/stats.html Normal file → Executable file
View File

@ -1,12 +1,14 @@
{% extends "aircox/controllers/base_site.html" %}
{% extends "admin/base_site.html" %}
{# {% extends "aircox/controllers/base_site.html" %} #}
{% load i18n %}
{% block title %}
<h1>Statistics of the stations</h1>
{% trans "Statistics of the stations" %}
{% endblock %}
{% block content %}
<div id='stats'>
<div id='content'>
<h1>{% trans "Statistics of the stations" %}</h1>
{# TODO here #}
<form action="?" method="GET">
@ -58,10 +60,10 @@
{% endfor %}
<tr class="bottom">
<td>{{ stats.date|date:'d/m/Y' }}</td>
<td>{% trans "Total" %}</td>
<th>{{ stats.date|date:'d/m/Y' }}</th>
<th>{% trans "Total" %}</th>
{# TODO: translation block #}
<td>
<th>
{% with stats.items|length as items_count %}
{% with stats.count as tracks_count %}
{% blocktrans %}
@ -69,11 +71,11 @@
{% endblocktrans %}
{% endwith %}
{% endwith %}
</td>
<td>{% for tag, count, average in stats.tags %}
</th>
<th>{% for tag, count, average in stats.tags %}
<span>{{ tag }}: <b>{{ average|floatformat }}%</b> ({{ count }})<br>
{% endfor %}
</td>
</th>
</tr>
</table>
</section>

0
aircox/urls.py Normal file → Executable file
View File

0
aircox/utils.py Normal file → Executable file
View File