From ae8e97fcc17a203a6b03a97e086e03210ae478d3 Mon Sep 17 00:00:00 2001 From: =?utf8?q?Fr=C3=A9d=C3=A9ric=20P=C3=A9ters?= Date: Sun, 29 Dec 2019 21:51:12 +0100 Subject: [PATCH] views: add an "archives" view --- chloro/phyll/static/css/style.scss | 11 ++++++++++- chloro/phyll/templates/phyll/home.html | 3 ++- chloro/phyll/urls.py | 1 + chloro/phyll/views.py | 10 ++++++++++ 4 files changed, 23 insertions(+), 2 deletions(-) diff --git a/chloro/phyll/static/css/style.scss b/chloro/phyll/static/css/style.scss index b46a441..c784925 100644 --- a/chloro/phyll/static/css/style.scss +++ b/chloro/phyll/static/css/style.scss @@ -66,16 +66,25 @@ main { .home { a { text-transform: uppercase; - display: block; + display: inline-block; text-decoration: none; font-size: 500%; font-weight: bold; padding-top: 0.5em; line-height: 50%; + width: 100%; span { font-size: 30%; } margin-bottom: 2rem; + &.divers { + width: 49%; + } + &.vrac { + width: 49%; + text-align: right; + float: right; + } } } diff --git a/chloro/phyll/templates/phyll/home.html b/chloro/phyll/templates/phyll/home.html index ad9596e..987a446 100644 --- a/chloro/phyll/templates/phyll/home.html +++ b/chloro/phyll/templates/phyll/home.html @@ -6,6 +6,7 @@
Radio (Panik & ailleurs) Logiciel libre (Debian, GNOME & ce qui passe) -(Totalement) divers +(Totalement) divers +(tout) En vrac
{% endblock %} diff --git a/chloro/phyll/urls.py b/chloro/phyll/urls.py index b3171df..37c2c64 100644 --- a/chloro/phyll/urls.py +++ b/chloro/phyll/urls.py @@ -42,6 +42,7 @@ urlpatterns = [ url(r'^feeds/(?P[\w:-]+)/atom$', views.AtomFeed()), url(r'^feed/atom$', views.AtomFeed()), url(r'^tag/(?P[\w:-]+)/$', views.ListOnTagView.as_view()), + url(r'^archives/$', views.ArchivesView.as_view()), url(r'^(?P\d{4})/(?P\d{2})/(?P\d{2})/(?P[\w:-]+)/$', views.NoteView.as_view()), url(r'^(?P[\w:-]+)/$', views.NoteView.as_view()), url(r'^$', views.HomeView.as_view()), diff --git a/chloro/phyll/views.py b/chloro/phyll/views.py index 5264298..78d2fec 100644 --- a/chloro/phyll/views.py +++ b/chloro/phyll/views.py @@ -66,6 +66,16 @@ class HomeView(TemplateView): template_name = 'phyll/home.html' +class ArchivesView(ListView): + model = Note + + def get_queryset(self): + qs = super(ArchivesView, self).get_queryset() + if not self.request.user.is_staff: + qs = qs.filter(published=True) + return qs + + class ListOnTagView(ListView): model = Note -- 2.39.2