]> git.0d.be Git - panikweb-studioneau.git/commitdiff
separate collections & shows
authorFrédéric Péters <fpeters@0d.be>
Sat, 17 Jul 2021 12:20:18 +0000 (14:20 +0200)
committerFrédéric Péters <fpeters@0d.be>
Sat, 17 Jul 2021 12:20:18 +0000 (14:20 +0200)
panikweb_studioneau/templates/emissions.html
panikweb_studioneau/templates/home.html
panikweb_studioneau/urls.py
panikweb_studioneau/views.py

index 918a9c6253ca29b5ad3691d95c8a25d19f36f26a..1804d1132fbcf669095cfd074f62a83846a7286b 100644 (file)
@@ -2,6 +2,6 @@
 {% load i18n %}
 
 {% block main %}
-<div><h2>{% trans "All Shows" %}</h2></div>
+<div><h2>{{ view.title }}</h2></div>
 {{ block.super }}
 {% endblock %}
index b98fe48ded1cf8ad0ca75936378d250f1fd3993b..5aa1ff411ca604f387c33962ac99b62fbddd09c6 100644 (file)
   {% weekview %}
 </div>
 
-<div id="stuff">
-  <h2>{% trans "Collection" %}</h2>
+{% if shows %}
+<div id="shows">
+  <h2>{% trans "Shows" %}</h2>
 
 <ul class="collection">
-{% for emission in emissions %}
+{% for emission in shows %}
     <li>
     {% emission_resume %}
     </li>
 </ul>
 
   <div class="mehr-button"><a href="{% url 'emissions' %}">{% trans "More" %}</a></div>
+</div>
+{% endif %}
+
+
 
+{% if collections %}
+<div id="collections">
+  <h2>{% trans "Collections" %}</h2>
+
+<ul class="collection">
+{% for emission in collections %}
+    <li>
+    {% emission_resume %}
+    </li>
+{% endfor %}
+</ul>
+
+  <div class="mehr-button"><a href="{% url 'collections' %}">{% trans "More" %}</a></div>
 </div>
+{% endif %}
 
 {% if newsitems %}
 <div id="news">
index 3db5bf27736a5987ebdbd988f6d1c2da9596dddf..07527b9642ed46680a05a3079a73e3b8fb0aec23 100644 (file)
@@ -1,7 +1,11 @@
+from django.conf import settings
 from django.conf.urls import url
 
 from . import views
 
 urlpatterns = [
+    url(r'^$', views.home),
+    url(r'^%s$' % settings.EMISSIONS_PREFIX, views.emissions),
+    url(r'^collections/$', views.collections, name='collections'),
     url(r'^tags/(?P<slug>[\w,-]+)/$', views.tag_items, name='tag-items'),
 ]
index 59c9ef35bbe83f6534e95bf21da5350ed2bb95d6..92d139dc43466e5f6b508e4fe4169a66ec4f68e0 100644 (file)
@@ -1,6 +1,38 @@
+import panikweb.views
+from django.utils.translation import ugettext_lazy as _
 from django.views.generic.base import TemplateView
 from emissions.models import Emission, Episode
-from taggit.models import Tag
+
+
+class Home(panikweb.views.Home):
+    def get_context_data(self, **kwargs):
+        context = super().get_context_data(**kwargs)
+        context['shows'] = Emission.objects.filter(archived=False).exclude(categories__slug='collection')
+        context['collections'] = Emission.objects.filter(archived=False).filter(categories__slug='collection')
+        return context
+
+
+home = Home.as_view()
+
+
+class Emissions(panikweb.views.Emissions):
+    title = _('All Shows')
+
+    def get_queryset(self):
+        return super().get_queryset().exclude(categories__slug='collection')
+
+
+emissions = Emissions.as_view()
+
+
+class Collections(panikweb.views.Emissions):
+    title = _('All Collections')
+
+    def get_queryset(self):
+        return super().get_queryset().filter(categories__slug='collection')
+
+
+collections = Collections.as_view()
 
 
 class TagItems(TemplateView):