forked from rc/aircox
		
	fix #4: more diffusion info on admin dashboard
This commit is contained in:
		@ -30,7 +30,7 @@ class AdminSite(admin.AdminSite):
 | 
				
			|||||||
            'programs': Program.objects.active().values('pk', 'title') \
 | 
					            'programs': Program.objects.active().values('pk', 'title') \
 | 
				
			||||||
                                       .order_by('title'),
 | 
					                                       .order_by('title'),
 | 
				
			||||||
            # today's diffusions
 | 
					            # today's diffusions
 | 
				
			||||||
            'diffusions': Diffusion.objects.on_air().date().order_by('start') \
 | 
					            'diffusions': Diffusion.objects.date().order_by('start') \
 | 
				
			||||||
                                   .select_related('episode'),
 | 
					                                   .select_related('episode'),
 | 
				
			||||||
            # TODO: only for dashboard
 | 
					            # TODO: only for dashboard
 | 
				
			||||||
            # last comments
 | 
					            # last comments
 | 
				
			||||||
 | 
				
			|||||||
@ -252,7 +252,7 @@ class Diffusion(BaseRerun):
 | 
				
			|||||||
        return self.type == self.TYPE_ON_AIR and \
 | 
					        return self.type == self.TYPE_ON_AIR and \
 | 
				
			||||||
            self.start <= now and self.end >= now
 | 
					            self.start <= now and self.end >= now
 | 
				
			||||||
 | 
					
 | 
				
			||||||
    # TODO: property?
 | 
					    @property
 | 
				
			||||||
    def is_live(self):
 | 
					    def is_live(self):
 | 
				
			||||||
        """ True if Diffusion is live (False if there are sounds files). """
 | 
					        """ True if Diffusion is live (False if there are sounds files). """
 | 
				
			||||||
        return self.type == self.TYPE_ON_AIR and \
 | 
					        return self.type == self.TYPE_ON_AIR and \
 | 
				
			||||||
 | 
				
			|||||||
@ -16,7 +16,31 @@
 | 
				
			|||||||
                <tr {% if diffusion.is_now %}class="is-selected"{% endif %}>
 | 
					                <tr {% if diffusion.is_now %}class="is-selected"{% endif %}>
 | 
				
			||||||
                    <td>{{ diffusion.start|time }} - {{ diffusion.end|time }}</td>
 | 
					                    <td>{{ diffusion.start|time }} - {{ diffusion.end|time }}</td>
 | 
				
			||||||
                    <td><img src="{% thumbnail episode.cover 64x64 crop %}"/></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>
 | 
				
			||||||
 | 
					                         
 | 
				
			||||||
 | 
					                        {% 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>
 | 
				
			||||||
 | 
					                             
 | 
				
			||||||
 | 
					                            {{ 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>
 | 
					                </tr>
 | 
				
			||||||
                {% endwith %}
 | 
					                {% endwith %}
 | 
				
			||||||
                {% endfor %}
 | 
					                {% endfor %}
 | 
				
			||||||
 | 
				
			|||||||
		Reference in New Issue
	
	Block a user