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...)
This commit is contained in:
Aurélien Delobelle 2017-04-05 15:34:28 +02:00
parent 42728e58be
commit 3ee9de93d9
7 changed files with 39 additions and 13 deletions

View file

@ -14,6 +14,11 @@ class Migration(migrations.Migration):
migrations.AddField( migrations.AddField(
model_name='articlecategory', model_name='articlecategory',
name='has_addcost', 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'),
), ),
] ]

View file

@ -341,8 +341,12 @@ class CheckoutStatement(models.Model):
@python_2_unicode_compatible @python_2_unicode_compatible
class ArticleCategory(models.Model): class ArticleCategory(models.Model):
name = models.CharField(max_length=45) name = models.CharField("nom", max_length=45)
has_addcost = models.BooleanField(default=True) 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): def __str__(self):
return self.name return self.name

View file

@ -16,6 +16,9 @@
<a class="btn btn-primary btn-lg" href="{% url 'kfet.article.create' %}"> <a class="btn btn-primary btn-lg" href="{% url 'kfet.article.create' %}">
Nouvel article Nouvel article
</a> </a>
<a class="btn btn-primary btn-lg" href="{% url 'kfet.category' %}">
Catégories
</a>
</div> </div>
</div> </div>
</div> </div>

View file

@ -12,7 +12,7 @@
<div class="row form-only"> <div class="row form-only">
<div class="col-sm-12 col-md-8 col-md-offset-2"> <div class="col-sm-12 col-md-8 col-md-offset-2">
<div class="content-form"> <div class="content-form">
<form submit="" method="post" class="form-horizontal"> <form action="" method="post" class="form-horizontal">
{% csrf_token %} {% csrf_token %}
{% include 'kfet/form_snippet.html' with form=form %} {% include 'kfet/form_snippet.html' with form=form %}
{% if not perms.kfet.change_article %} {% if not perms.kfet.change_article %}

View file

@ -26,7 +26,7 @@
<td></td> <td></td>
<td>Nom</td> <td>Nom</td>
<td class="text-right">Nombre d'articles</td> <td class="text-right">Nombre d'articles</td>
<td class="text-right">Peut-être majoré</td> <td class="text-right">Peut être majorée</td>
</tr> </tr>
</thead> </thead>
<tbody> <tbody>

View file

@ -5,13 +5,21 @@
{% block content %} {% block content %}
<form action="" method="post"> {% include "kfet/base_messages.html" %}
{% csrf_token %}
{{ form.as_p }} <div class="row form-only">
{% if not perms.kfet.change_articlecategory %} <div class="col-sm-12 col-md-8 col-md-offset-2">
<input type="password" name="KFETPASSWORD"> <div class="content-form">
{% endif %} <form action="" method="post" class="form-horizontal">
<input type="submit" value="Mettre à jour"> {% csrf_token %}
</form> {% 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"%}
<form>
</div>
</div>
</div>
{% endblock %} {% endblock %}

View file

@ -69,6 +69,12 @@ urlpatterns = [
name='kfet.account.negative'), name='kfet.account.negative'),
# Account - Statistics # Account - Statistics
url(r'^accounts/(?P<trigramme>.{3})/stat/operations/list$',
views.AccountStatOperationList.as_view(),
name='kfet.account.stat.operation.list'),
url(r'^accounts/(?P<trigramme>.{3})/stat/operations$',
views.AccountStatOperation.as_view(),
name='kfet.account.stat.operation'),
url(r'^accounts/(?P<trigramme>.{3})/stat/balance/list$', url(r'^accounts/(?P<trigramme>.{3})/stat/balance/list$',
views.AccountStatBalanceList.as_view(), views.AccountStatBalanceList.as_view(),