diff --git a/kfet/templates/kfet/article.html b/kfet/templates/kfet/article.html
index 87a8b76a..6b48ddbb 100644
--- a/kfet/templates/kfet/article.html
+++ b/kfet/templates/kfet/article.html
@@ -7,8 +7,11 @@
@@ -25,6 +28,7 @@
{% endblock %}
{% block main %}
+
Article{{ articles|length|pluralize}} en vente
+Article{{ not_sold_articles|length|pluralize }} non vendu{{ nots_sold_article|length|pluralize }}
+
+
+
+
+ Nom |
+ Prix |
+ Stock |
+ En vente |
+ Affiché |
+ Dernier inventaire |
+
+
+ {% regroup not_sold_articles by category as not_sold_category_list %}
+
+ {% for category in not_sold_category_list %}
+
+
+ {{ category.grouper }} |
+
+
+
+ {% for article in category.list %}
+
+
+
+ {{ article.name }}
+
+ |
+ {{ article.price }}€ |
+ {{ article.stock }} |
+ {{ article.is_sold | yesno:"En vente,Non vendu"}} |
+ {{ article.hidden | yesno:"Caché,Affiché" }} |
+ {% with last_inventory=article.inventory.0 %}
+
+ {{ last_inventory.at|date:'d/m/Y H:i' }}
+ |
+ {% endwith %}
+
+ {% endfor %}
+
+ {% endfor %}
+
+
+
+
{% endblock %}
diff --git a/kfet/views.py b/kfet/views.py
index 4c4059e8..5076e5b8 100644
--- a/kfet/views.py
+++ b/kfet/views.py
@@ -706,6 +706,14 @@ class ArticleList(ListView):
)
template_name = 'kfet/article.html'
context_object_name = 'articles'
+
+ def get_context_data(self, **kwargs):
+ context = super().get_context_data(**kwargs)
+ articles = context[self.context_object_name]
+ context['nb_articles'] = len(articles)
+ context[self.context_object_name] = articles.filter(is_sold=True)
+ context['not_sold_articles'] = articles.filter(is_sold=False)
+ return context
# Article - Create