Commit 7f602534 authored by fred's avatar fred

add agenda view

parent e088df45
......@@ -21,6 +21,7 @@ urlpatterns = patterns('',
url(r'^sons/$', 'panikweb.views.listen', name='listen'),
url(r'^sons/archives/$', 'panikweb.search.listenArchives', name='listenArchives'),
url(r'^actus/$', 'panikweb.views.news', name='news'),
url(r'^actus/agenda/$', 'panikweb.views.agenda', name='agenda'),
url(r'^actus/archives/$', 'panikweb.search.newsArchives', name='newsArchives'),
url(r'^actus/(?P<slug>[\w,-]+)$', 'panikweb.views.newsitemview', name='newsitem-view'),
......
from datetime import datetime, timedelta
from datetime import datetime, timedelta, date
import math
import random
import os
......@@ -468,6 +468,19 @@ class News(TemplateView):
news = News.as_view()
class Agenda(TemplateView):
template_name = 'agenda.html'
def get_context_data(self, **kwargs):
context = super(Agenda, self).get_context_data(**kwargs)
context['sectionName'] = "News"
context['agenda'] = NewsItem.objects.filter(
event_date__lte=date.today()).order_by('date')[:20]
context['news'] = NewsItem.objects.all().order_by('-date')
return context
agenda = Agenda.as_view()
class Emissions(TemplateView):
template_name = 'emissions.html'
......
......@@ -364,6 +364,7 @@ body{
margin-bottom: 10px;
}
#News div.mainSub,
#About div.mainSub,
#Emissions div.mainSub {
position: absolute;
......@@ -373,6 +374,7 @@ body{
width: calc(98% - 320px);
}
#News div.mainSub ul,
#About div.mainSub ul,
#Emissions div.mainSub ul {
padding: 0;
......@@ -380,6 +382,7 @@ body{
font-weight: normal;
}
#News div.mainSub ul li,
#About div.mainSub ul li,
#Emissions div.mainSub ul li {
}
......
{% extends "base.html"%}
{% load paniktags i18n %}
{% block title %}Actus{% endblock %}
{% block toptitle %}
<h1 class="top"><a href="{% url 'news' %}">Actus</a> - L'agenda</h1>
{% endblock %}
{% block nav %}
{% news_nav %}
{% endblock %}
{% block main %}
<div class="detail marged news cf">
<div class="wrapper navigation">
<p class="intro leftPart">
Tous les jours, il s'en passe des choses que Panik fomente, fait résonner et
vous fait savoir.
</p>
<div class="leftPart">
<div class="news">
{% regroup agenda|dictsort:'event_date' by event_date as agenda_list %}
{% for date in agenda_list %}
<h3>{{ date.grouper|date:"l d E"|lower }}</h3>
{% for content in date.list %}
{% news_inline %}
{% endfor %}
{% endfor %}
{% if not agenda %}
<div class="big error center">Misère, c'est l'hiver ?!</div>
{% endif %}
</div>
</div>
<div class="rightPart">
<div class="sub">
<h5 class="sectionLabel right">
<a href="{% url 'newsArchives' %}">
<span class="iconLabel">Toutes</span>
</a>
</h5>
<h5 class="sectionLabel">
<span class="iconLabel">Dernières actus</span>
<a class="button icon-rss inBlock" href="{% url 'rss-feed' %}"></a>
</h5>
<form action="{% url 'newsArchives' %}" id="search-form">
<input id="id_q" name="q" type="text" {% if search_query %}value="{{ search_query }}"{% endif %}>
<button class="icon-search"></button>
</form>
<ul class="custom list newsList">
{% for content in news|slice:":20" %}
<li class="{% if content == newsitem %}current{% endif %}">{% news_inline %}</li>
{% endfor %}
</ul>
</div>
</div>
</div>
</div>
{% endblock %}
{% block links %}
<div class="wrapper">
<div class="padded ">
<ul class="news columns padded list custom">
{% for NewsItem in newsAll %}
<li class="item ellipsis small ">
<a href="{% url 'newsitem-view' slug=NewsItem.slug %}">
<span class="title"><strong>{{ NewsItem.date|date:"D d/M" }}</strong>&nbsp;-&nbsp;{{ NewsItem.title }}</span>
</a>
</li>
{% endfor %}
</ul>
</div>
</div>
</div>
{% endblock %}
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