Commit 60eca369 authored by fred's avatar fred

add newsitem management

parent c936d1fa
......@@ -8,14 +8,14 @@
<a class="big-friendly-button" href="{% url 'episode-add' emission_slug=emission.slug %}">Ajouter un épisode</a>
<a class="big-friendly-button" href="#">Ajouter une actu</a>
<a class="big-friendly-button" href="{% url 'emission-newsitem-add' emission_slug=emission.slug %}">Ajouter une actu</a>
<a class="big-friendly-button" href="{% url 'emission-update' slug=emission.slug %}">Modifier l'émission</a>
<h4>Épisodes récents</h4>
<ul class="episode-list">
{% for episode in emission.get_sorted_emissions|slice:":10" %}
{% for episode in emission.get_sorted_episodes|slice:":10" %}
<li>{{ episode.diffusion_set.all.0.datetime|date:"d E o H:i"|lower }}
<br/>   <a href="{% url 'episode-view' emission_slug=emission.slug slug=episode.slug %}">{{ episode.title }}</a>
{% if episode.has_sound %}<span class="icon-music"/>{%endif%}
......@@ -23,7 +23,34 @@
{% endfor %}
</ul>
<h4>Actus récentes</h4>
<ul class="episode-list">
{% for newsitem in emission.get_sorted_newsitems|slice:":10" %}
<li>{{ newsitem.datetime|date:"d E o H:i"|lower }}
<a href="{% url 'newsitem-view' slug=newsitem.slug %}">{{ newsitem.title }}</a>
</li>
{% endfor %}
</ul>
{% endfor %}
{% for news_category in news_categories %}
<h2>{{ news_category.title }}</h2>
<a class="big-friendly-button" href="{% url 'newsitem-add' slug=news_category.slug %}">Ajouter une actu</a>
<ul class="episode-list">
{% for newsitem in news_category.get_sorted_newsitems|slice:":10" %}
<li>{{ newsitem.datetime|date:"d E o H:i"|lower }}
<a href="{% url 'newsitem-view' slug=newsitem.slug %}">{{ newsitem.title }}</a>
</li>
{% endfor %}
</ul>
{% endfor %}
{% endblock %}
......@@ -9,6 +9,7 @@ class Home(TemplateView):
def get_context_data(self, **kwargs):
context = super(Home, self).get_context_data(**kwargs)
context['emissions'] = self.request.user.emissions.all().order_by('title')
context['news_categories'] = self.request.user.news_categories.all().order_by('title')
return context
home = login_required(Home.as_view())
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment