From 3ee9de93d9a458d0bab750774c46ec9b1878a2ed Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Aur=C3=A9lien=20Delobelle?= Date: Wed, 5 Apr 2017 15:34:28 +0200 Subject: [PATCH] few improvements on article category - add verbose names to ArticleCategory fields - add button to view categories list from articles list - fix article_update template in form validation - improve interface for articlecategory_update - revert vanished urls (happened in merge with master...) --- kfet/migrations/0052_category_addcost.py | 7 ++++++- kfet/models.py | 8 ++++++-- kfet/templates/kfet/article.html | 3 +++ kfet/templates/kfet/article_update.html | 2 +- kfet/templates/kfet/category.html | 2 +- kfet/templates/kfet/category_update.html | 24 ++++++++++++++++-------- kfet/urls.py | 6 ++++++ 7 files changed, 39 insertions(+), 13 deletions(-) diff --git a/kfet/migrations/0052_category_addcost.py b/kfet/migrations/0052_category_addcost.py index 62dab063..83346a1a 100644 --- a/kfet/migrations/0052_category_addcost.py +++ b/kfet/migrations/0052_category_addcost.py @@ -14,6 +14,11 @@ class Migration(migrations.Migration): migrations.AddField( model_name='articlecategory', name='has_addcost', - field=models.BooleanField(default=True), + field=models.BooleanField(default=True, help_text="Si oui et qu'une majoration est active, celle-ci sera appliquée aux articles de cette catégorie.", verbose_name='majorée'), + ), + migrations.AlterField( + model_name='articlecategory', + name='name', + field=models.CharField(max_length=45, verbose_name='nom'), ), ] diff --git a/kfet/models.py b/kfet/models.py index bee14156..cb8c324b 100644 --- a/kfet/models.py +++ b/kfet/models.py @@ -341,8 +341,12 @@ class CheckoutStatement(models.Model): @python_2_unicode_compatible class ArticleCategory(models.Model): - name = models.CharField(max_length=45) - has_addcost = models.BooleanField(default=True) + name = models.CharField("nom", max_length=45) + has_addcost = models.BooleanField("majorée", default=True, + help_text="Si oui et qu'une majoration " + "est active, celle-ci sera " + "appliquée aux articles de " + "cette catégorie.") def __str__(self): return self.name diff --git a/kfet/templates/kfet/article.html b/kfet/templates/kfet/article.html index 17c831df..123f4cfa 100644 --- a/kfet/templates/kfet/article.html +++ b/kfet/templates/kfet/article.html @@ -16,6 +16,9 @@ Nouvel article + + Catégories + diff --git a/kfet/templates/kfet/article_update.html b/kfet/templates/kfet/article_update.html index 85a29f6b..a3bfbcc6 100644 --- a/kfet/templates/kfet/article_update.html +++ b/kfet/templates/kfet/article_update.html @@ -12,7 +12,7 @@
-
+ {% csrf_token %} {% include 'kfet/form_snippet.html' with form=form %} {% if not perms.kfet.change_article %} diff --git a/kfet/templates/kfet/category.html b/kfet/templates/kfet/category.html index 4de44207..5393bf59 100644 --- a/kfet/templates/kfet/category.html +++ b/kfet/templates/kfet/category.html @@ -26,7 +26,7 @@ Nom Nombre d'articles - Peut-être majoré + Peut être majorée diff --git a/kfet/templates/kfet/category_update.html b/kfet/templates/kfet/category_update.html index fb04e12b..1a26d001 100644 --- a/kfet/templates/kfet/category_update.html +++ b/kfet/templates/kfet/category_update.html @@ -5,13 +5,21 @@ {% block content %} - - {% csrf_token %} - {{ form.as_p }} - {% if not perms.kfet.change_articlecategory %} - - {% endif %} - -
+{% include "kfet/base_messages.html" %} + +
+
+
+
+ {% csrf_token %} + {% include 'kfet/form_snippet.html' with form=form %} + {% if not perms.kfet.edit_articlecategory %} + {% include 'kfet/form_authentication_snippet.html' %} + {% endif %} + {% include 'kfet/form_submit_snippet.html' with value="Enregistrer"%} + +
+
+
{% endblock %} diff --git a/kfet/urls.py b/kfet/urls.py index a4393f8d..bc1f3370 100644 --- a/kfet/urls.py +++ b/kfet/urls.py @@ -69,6 +69,12 @@ urlpatterns = [ name='kfet.account.negative'), # Account - Statistics + url(r'^accounts/(?P.{3})/stat/operations/list$', + views.AccountStatOperationList.as_view(), + name='kfet.account.stat.operation.list'), + url(r'^accounts/(?P.{3})/stat/operations$', + views.AccountStatOperation.as_view(), + name='kfet.account.stat.operation'), url(r'^accounts/(?P.{3})/stat/balance/list$', views.AccountStatBalanceList.as_view(),