Commit 6748a09d authored by fred's avatar fred

add browsing to newsitems

parent 1b0d39aa
......@@ -371,6 +371,14 @@ ul.episode-list {
-webkit-column-count: 2;
}
ul.newsitem-list {
column-count: 2;
-moz-column-count: 2;
-webkit-column-count: 2;
}
.fileprogress {
border: 1px solid #888;
}
......
{% extends "base.html" %}
{% block appbar %}
{% if user.is_staff %}
<span><a href="{% url 'emission-list' %}">Toutes les émissions</a>
-
<a href="{% url 'news-list' %}">Toutes les actus</a></span>
{% endif %}
{% endblock %}
{% block content %}
<h2>Actus</h2>
{% for category in object_list %}
<h3>{{ category.title }}</h3>
<ul class="newsitem-list">
{% for newsitem in category.sorted_news %}
<li><a href="{% url 'newsitem-view' slug=newsitem.slug %}">{{ newsitem.title }}</a></li>
{% endfor %}
</ul>
{% endfor %}
<h3>Actus non rangées</h3>
<ul class="newsitem-list">
{% for newsitem in unsorted_newsitems %}
<li><a href="{% url 'newsitem-view' slug=newsitem.slug %}">{{ newsitem.title }}</a></li>
{% endfor %}
</ul>
{% endblock %}
......@@ -2,7 +2,9 @@
{% block appbar %}
{% if user.is_staff %}
<span><a href="{% url 'emission-list' %}">Toutes les émissions</a></span>
<span><a href="{% url 'emission-list' %}">Toutes les émissions</a>
-
<a href="{% url 'news-list' %}">Toutes les actus</a></span>
{% endif %}
{% endblock %}
......
......@@ -25,11 +25,13 @@ urlpatterns = patterns('',
url(r'^search/', search_view_factory(view_class=FacetedSearchView,
form_class=FacetedSearchForm, searchqueryset=sqs), name='haystack_search'),
url(r'^$', 'panikdb.views.emissions', name='emission-list'),
url(r'^emissions/$', 'panikdb.views.emissions', name='emission-list'),
url(r'^emissions/',
decorated_includes(login_required, include(emissions_urlpatterns))),
url(r'^news/$', 'panikdb.views.news', name='news-list'),
url(r'^accounts/logout/', 'django.contrib.auth.views.logout_then_login', name='logout'),
url(r'^accounts/', include('registration.backends.default.urls')),
......
from django.contrib.auth.decorators import login_required
from django.views.generic.base import TemplateView
from django.views.generic.list import ListView
from emissions.models import Emission
from emissions.models import Emission, NewsCategory, NewsItem
import emissions.views
......@@ -22,3 +23,18 @@ class EmissionListView(emissions.views.EmissionListView):
pass
emissions = login_required(EmissionListView.as_view())
class NewsListView(ListView):
model = NewsCategory
def get_queryset(self):
return NewsCategory.objects.order_by('title')
def get_context_data(self, **kwargs):
context = super(NewsListView, self).get_context_data(**kwargs)
context['unsorted_newsitems'] = NewsItem.objects.filter(category__isnull=True).order_by('title')
return context
news = login_required(NewsListView.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