Merge pull request 'fix #4: survue de programmation de la journee (cfr horaire-check)' (#27) from fix-1.0-4 into develop-1.0

Reviewed-on: #27
This commit is contained in:
Thomas Kairos 2022-02-22 11:20:27 +01:00
commit 95a847cee0
3 changed files with 27 additions and 3 deletions

View File

@ -30,7 +30,7 @@ class AdminSite(admin.AdminSite):
'programs': Program.objects.active().values('pk', 'title') \
.order_by('title'),
# today's diffusions
'diffusions': Diffusion.objects.on_air().date().order_by('start') \
'diffusions': Diffusion.objects.date().order_by('start') \
.select_related('episode'),
# TODO: only for dashboard
# last comments

View File

@ -252,7 +252,7 @@ class Diffusion(BaseRerun):
return self.type == self.TYPE_ON_AIR and \
self.start <= now and self.end >= now
# TODO: property?
@property
def is_live(self):
""" True if Diffusion is live (False if there are sounds files). """
return self.type == self.TYPE_ON_AIR and \

View File

@ -16,7 +16,31 @@
<tr {% if diffusion.is_now %}class="is-selected"{% endif %}>
<td>{{ diffusion.start|time }} - {{ diffusion.end|time }}</td>
<td><img src="{% thumbnail episode.cover 64x64 crop %}"/></td>
<td><a href="{% url "admin:aircox_episode_change" episode.pk %}">{{ episode.title }}</a></td>
<td>
<a href="{% url "admin:aircox_episode_change" episode.pk %}">{{ episode.title }}</a>
&nbsp;
{% if diffusion.type == diffusion.TYPE_ON_AIR %}
<span class="tag is-info">
<span class="icon is-small">
{% if diffusion.is_live %}
<i class="fa fa-microphone"
title="{% trans "Live diffusion" %}"></i>
{% else %}
<i class="fa fa-music"
title="{% trans "Differed diffusion" %}"></i>
{% endif %}
</span>
&nbsp;
{{ diffusion.get_type_display }}
</span>
{% elif diffusion.type == diffusion.TYPE_CANCEL %}
<span class="tag is-danger">
{{ diffusion.get_type_display }}</span>
{% elif diffusion.type == diffusion.TYPE_UNCONFIRMED %}
<span class="tag is-warning">
{{ diffusion.get_type_display }}</span>
{% endif %}
</td>
</tr>
{% endwith %}
{% endfor %}