From a4244070b1e0ce029253897da8b546b6e8a1070b Mon Sep 17 00:00:00 2001 From: chirac Date: Sun, 17 Jul 2016 21:20:43 +0200 Subject: [PATCH] Un peu de style sur les formulaire d'edition de factures --- .../templates/cotisations/edit_facture.html | 37 +++++++++++++++++++ .../templates/cotisations/facture.html | 5 --- .../templates/cotisations/new_facture.html | 10 ++++- cotisations/views.py | 4 +- 4 files changed, 47 insertions(+), 9 deletions(-) create mode 100644 cotisations/templates/cotisations/edit_facture.html diff --git a/cotisations/templates/cotisations/edit_facture.html b/cotisations/templates/cotisations/edit_facture.html new file mode 100644 index 00000000..4b278097 --- /dev/null +++ b/cotisations/templates/cotisations/edit_facture.html @@ -0,0 +1,37 @@ +{% extends "cotisations/sidebar.html" %} +{% load bootstrap3 %} +{% load staticfiles%} + +{% block title %}Création et modification de factures{% endblock %} + +{% block content %} +{% bootstrap_form_errors factureform %} + +
+ {% csrf_token %} +

Editer la facture

+ {% bootstrap_form factureform %} + {{ venteform.management_form }} +

Articles de la facture

+ + + + + + + + {% for form in venteform.forms %} + {% bootstrap_form_errors form %} + + + + {% for hidden in form.hidden_fields %} + {{ hidden }} + {% endfor %} + + {% endfor %} +
DésignationQuantité
{{ form.name }}{{ form.number }}
+ {% bootstrap_button "Créer ou modifier" button_type="submit" icon="star" %} +
+ +{% endblock %} diff --git a/cotisations/templates/cotisations/facture.html b/cotisations/templates/cotisations/facture.html index 7b9bc89e..d5a10270 100644 --- a/cotisations/templates/cotisations/facture.html +++ b/cotisations/templates/cotisations/facture.html @@ -10,11 +10,6 @@
{% csrf_token %} {% bootstrap_form factureform %} - {{ venteform.management_form }} - {% for form in venteform.forms %} - {% bootstrap_form_errors form %} - {{ form.as_p }} - {% endfor %} {% bootstrap_button "Créer ou modifier" button_type="submit" icon="star" %}
diff --git a/cotisations/templates/cotisations/new_facture.html b/cotisations/templates/cotisations/new_facture.html index 2795718a..57b0f9e4 100644 --- a/cotisations/templates/cotisations/new_facture.html +++ b/cotisations/templates/cotisations/new_facture.html @@ -9,16 +9,22 @@
{% csrf_token %} +

Nouvelle facture

{% bootstrap_form factureform %} {{ venteform.management_form }} +

Articles de la facture

{% for form in venteform.forms %}
- {{ form.as_p }} +

+ {{ form.as_table }} +

{% endfor %}
+

+

Prix total : 0,00

@@ -35,7 +41,7 @@ prices[{{ article.id|escapejs }}] = {{ article.prix }}; {% endfor %} - var template = `{{ venteform.empty_form.as_p }}`; + var template = `

{{ venteform.empty_form.as_table }}

`; function add_article(){ // Index start at 0 => new_index = number of items diff --git a/cotisations/views.py b/cotisations/views.py index b12248bd..6cc533c6 100644 --- a/cotisations/views.py +++ b/cotisations/views.py @@ -134,7 +134,7 @@ def edit_facture(request, factureid): vente_form.save() messages.success(request, "La facture a bien été modifiée") return redirect("/cotisations/") - return form({'factureform': facture_form, 'venteform': vente_form}, 'cotisations/facture.html', request) + return form({'factureform': facture_form, 'venteform': vente_form}, 'cotisations/edit_facture.html', request) @login_required @permission_required('cableur') @@ -241,7 +241,7 @@ def add_banque(request): @permission_required('trésorier') def edit_banque(request, banqueid): try: - banque_instance = Article.objects.get(pk=banqueid) + banque_instance = Banque.objects.get(pk=banqueid) except Banque.DoesNotExist: messages.error(request, u"Entrée inexistante" ) return redirect("/cotisations/index_banque/")