diff --git a/apps/rp/templates/rp/article_list.html b/apps/rp/templates/rp/article_list.html index 33b66e37c45414a355dc645e0bd0d7b94ab0f067..4b0553463f342edef61459508939c85bf4fec974 100644 --- a/apps/rp/templates/rp/article_list.html +++ b/apps/rp/templates/rp/article_list.html @@ -1,7 +1,91 @@ {% extends "base.html" %} {% block content %} - {% for article in object_list %} - {% endfor %} +
+
+ + +
+ {% if is_paginated %} + + {% endif %} + + + + + + + + + + + + + + + + {% for article in object_list|slice:":10" %} + + + + + + + + + + + + + + + {% endfor %} + +
PriorityIDDateLanguageTitleNoteAdded byActions
{{article.id}}{{article.created_at |date:'d/m/y'}}
{{article.created_at |date:'H:i'}}
{{article.lang}}{{article.title}} + + {{article.und_votes.first.username}} + +
+ Tags tags tags +
+
+
+
{% endblock %} diff --git a/apps/rp/urls.py b/apps/rp/urls.py index a77e67a0fa31f1a75696d1ebc61c889299cf183a..8e55da0c833e5a2a42aa7ad740763e37dc87e79b 100644 --- a/apps/rp/urls.py +++ b/apps/rp/urls.py @@ -1,11 +1,11 @@ from django.conf.urls import url from rp.views.votes import upvote, downvote -from rp.views.articles import ArticleList +from rp.views.articles import ArticleListFlux urlpatterns = [ url( - r"^article/list", - ArticleList.as_view(), + r"^article/list/(?P\w+)", + ArticleListFlux.as_view(), name="article-list" ), url( diff --git a/apps/rp/views/articles.py b/apps/rp/views/articles.py index d10033c77800fc52839b8f4a23582c211fe1925b..bdc7636ac733f055e775cd39ec956b9af75ef262 100644 --- a/apps/rp/views/articles.py +++ b/apps/rp/views/articles.py @@ -2,5 +2,24 @@ from rp.models import Article from .votes import UDList -class ArticleList(UDList): +class ArticleListFlux(UDList): model = Article + paginate_by = 10 + + def get_queryset(self): + filter_view = self.kwargs.get("filter_view", "draft") + + if filter_view == "published": + qs = Article.objects.filter(status="PUBLISHED") + elif filter_view == "draft": + qs = Article.objects.filter(und_score__gte=3, status="PENDING") + else: + qs = Article.objects.filter(status="PENDING") + + return qs.order_by('-created_at') + + def get_context_data(self, **kwargs): + context = super().get_context_data(**kwargs) + context["filter_view"] = self.kwargs.get("filter_view", "draft") + context["nb_draft"] = Article.objects.filter(und_score__gte=3, status="PENDING").count() + return context diff --git a/templates/base.html b/templates/base.html index 6680bcd8e18bef729c8c5bff8f98a5a8a7e19d32..cc6d0a99572b9e47dd969114804b592a60ade0d2 100644 --- a/templates/base.html +++ b/templates/base.html @@ -1,11 +1,213 @@ - - - - - LQDN RP - - - {% block content %} - {% endblock %} - +{% load static %} + + + + + Soutenez La Quadrature du Net ! + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
+ + + + +
+ + + + + +
+
+ +
+ +
+
+

Lorem ipsum dolor sit amet, consectetur adipisicing elit. Corporis repellendus voluptates est nesciunt eum recusandae, quisquam reprehenderit impedit iusto, quo sint. Odio voluptatem odit voluptate, facilis esse dolores animi repellendus?

+
+
+

Lorem ipsum dolor sit amet, consectetur adipisicing elit. Delectus voluptas earum assumenda, perspiciatis dicta maxime quo illum repudiandae itaque omnis fuga explicabo magni minus maiores laboriosam voluptatibus doloremque. Nostrum, corrupti.

+
+
+
+ + +
+ {% block content %} + {% endblock %} +
+ +