From 35899f093b84b2295b2433ec9f940d7dfab08f0d Mon Sep 17 00:00:00 2001 From: chirac Date: Sat, 2 Jul 2016 15:58:50 +0200 Subject: [PATCH] Ajoute une app pour les factures --- cotisations/__init__.py | 0 .../__pycache__/__init__.cpython-34.pyc | Bin 0 -> 120 bytes cotisations/__pycache__/admin.cpython-34.pyc | Bin 0 -> 165 bytes cotisations/__pycache__/models.cpython-34.pyc | Bin 0 -> 3640 bytes cotisations/__pycache__/urls.cpython-34.pyc | Bin 0 -> 439 bytes cotisations/__pycache__/views.cpython-34.pyc | Bin 0 -> 1967 bytes cotisations/admin.py | 3 + cotisations/migrations/0001_initial.py | 60 ++++++++++++++++ cotisations/migrations/__init__.py | 0 .../__pycache__/0001_initial.cpython-34.pyc | Bin 0 -> 1774 bytes .../__pycache__/__init__.cpython-34.pyc | Bin 0 -> 131 bytes cotisations/models.py | 68 ++++++++++++++++++ .../templates/cotisations/facture.html | 14 ++++ cotisations/templates/cotisations/index.html | 28 ++++++++ .../templates/cotisations/sidebar.html | 7 ++ cotisations/tests.py | 3 + cotisations/urls.py | 11 +++ cotisations/views.py | 41 +++++++++++ re2o/urls.py | 1 + 19 files changed, 236 insertions(+) create mode 100644 cotisations/__init__.py create mode 100644 cotisations/__pycache__/__init__.cpython-34.pyc create mode 100644 cotisations/__pycache__/admin.cpython-34.pyc create mode 100644 cotisations/__pycache__/models.cpython-34.pyc create mode 100644 cotisations/__pycache__/urls.cpython-34.pyc create mode 100644 cotisations/__pycache__/views.cpython-34.pyc create mode 100644 cotisations/admin.py create mode 100644 cotisations/migrations/0001_initial.py create mode 100644 cotisations/migrations/__init__.py create mode 100644 cotisations/migrations/__pycache__/0001_initial.cpython-34.pyc create mode 100644 cotisations/migrations/__pycache__/__init__.cpython-34.pyc create mode 100644 cotisations/models.py create mode 100644 cotisations/templates/cotisations/facture.html create mode 100644 cotisations/templates/cotisations/index.html create mode 100644 cotisations/templates/cotisations/sidebar.html create mode 100644 cotisations/tests.py create mode 100644 cotisations/urls.py create mode 100644 cotisations/views.py diff --git a/cotisations/__init__.py b/cotisations/__init__.py new file mode 100644 index 00000000..e69de29b diff --git a/cotisations/__pycache__/__init__.cpython-34.pyc b/cotisations/__pycache__/__init__.cpython-34.pyc new file mode 100644 index 0000000000000000000000000000000000000000..ca281b3555371fe85c20fc47b987605b0393605b GIT binary patch literal 120 zcmaFI!^_n-wLF{w2p)q77+?f49Dul(1xTbYFa&Ed`mJOr0tq9CU#j|LiADP5<>mTC vsYdzw$@wLj#fc@E`FX|q@$s2?nI-Y@dIgoYIBatBQ%ZAE?LgX#ftUdRb|V{1 literal 0 HcmV?d00001 diff --git a/cotisations/__pycache__/admin.cpython-34.pyc b/cotisations/__pycache__/admin.cpython-34.pyc new file mode 100644 index 0000000000000000000000000000000000000000..0e4e22211de9a2103651dcc4eede17350d4405df GIT binary patch literal 165 zcmaFI!^_n-wLILOfq~&M5W@izkmUfx#Uel=1&A0Kau^tL85yD&85mQT7=ksKUjk(q zG#PKPCZ^m}#sl@w(r6@d&{$xy@$q`<^4CH=C*BK`96a{Z!I pqkR43{F2P##FEVXykdQ@A$kRsw>WHa^HWN5QtcRl+KPdg0RXOeCYk^M literal 0 HcmV?d00001 diff --git a/cotisations/__pycache__/models.cpython-34.pyc b/cotisations/__pycache__/models.cpython-34.pyc new file mode 100644 index 0000000000000000000000000000000000000000..30b89c47986592a088b42b752fea8d1ca559a981 GIT binary patch literal 3640 zcmcgv%W@k<6z!2_Mi0yKBO$hd0*6O|c-Ro0RZx`ka*CoN0ya=Jo2jv;Esq#UPWK2W zuIxg=3ciE<0^96aQ7n4P${Us}*uXhGk}V560V;*$zUsbrx~Kc}xu@H|)uyXI{kZqV z?`0u=6=NS4^)(dzGfa#>N2Ee@9T7OfVY?vGg6I}SP|Vv!k-DPmiNMR-u1I~+Es3Bc zoNKWsVqbiXZoZI?=#<4>^sI<$aY@8w8z_$jst8m>T(yDfSYQf)DG}Ffpf(n$AuuiC zx((EY^y~|!;hhojto6>0ymb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4{ z+=SQ!!U#|cm-(oumNNZLy+u~3< z?yWhiRdX^EtbUm%X<11Yo!{I~D#awH)2GYv_47qAYAuoEtnpAb-pQKLj8R_x%i291 zBsRVl{pA?5QQPB!ve&!7X$N$fh(!^mg_wspm68UI)q=F}h;_4l^|&juzsbIqd6=rO!9(O8Jp^VP!76*F))W@ GNPYn$8*&o> literal 0 HcmV?d00001 diff --git a/cotisations/__pycache__/views.cpython-34.pyc b/cotisations/__pycache__/views.cpython-34.pyc new file mode 100644 index 0000000000000000000000000000000000000000..fa02e8e842e9e6c773cc2d3cdd3482bfc733550e GIT binary patch literal 1967 zcmaKs&2HpG5P+*~kLS1p#hPV7JL~TyOZ^-e}?Lw zOcEuh@Cb+(;FJTez=6C)UpaB%0XR|Bc9zKsVU26LyUN{N^;OkhL9g@E?~7-@_yB*v z(&NzhQ+m~JBog`w$N+Kyp@7_h&;h}#j$L&jbRqX3^r}@CvIgWngnl*mAZtS2g0Ka7 z8^Si^9SA#>t^rvW@&Ll1n){ITAn!xihkO9x0P-P(L&#SkTp^1lBrW(6AY6r{4N1q2 z*C6Ra64>!;kn|ww+wnRi1K1x8|0Ew^Rl{%h#pHqnEhAF1_j@iF1Gp7tURn0%!r} z4qOWU3GKi+&0WT%$)Zv?Vt?d}%`mPmJV^_sqav1cD}O#qA}x`(M?MEzBuL@L`oy%f z%x4+tO%p30jfk%R*U9GZt)1ftcNUAq4$6n+PF(6#MLMOx?Hs3ap|)qI#ycce1F}|p z00>{K34EPKG3OOOd?vrvw*?I}z*NB0VHe1kOAr^1^@Y|wm_4vbNN%!gqK-m?%mBZ) z5%GB}bQ7j6j#J{oCFQ859Pv0r`?>>Z6`}?_PJFhxbSXKSW8=*gC&f*8=6C2iUq+jU z6}8Q1^ZH6(Uv0*CeI?I&w>&o8+KL@MyR#gOTCx3H=h>)>J=)YXtE5uKk5O{`yS(as z{nh?cI$uqWqbyB~r=nwt9s7Zr$1x=nx-_#99C^6L8lNvs#?AU16V!tVU&W%T#0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5S&G5bnvu6{+v=>I@L=vXx2sOjYCg~8Rayf;sv1Iv_g`BHqSSMhY z`D``HOHouuxOLSz>E$o=aJl1%nt2x0oHGEHZR0TUnp{&UEZqhtk@-f||<^uf#v}lR!^N01Qy5gqb@|ZLvMS%5b7r^t lALyQ?Ek7YJ#@R)F74;b%LwXe1B!lPxyzGbzY{{VpPx)cBa literal 0 HcmV?d00001 diff --git a/cotisations/migrations/__pycache__/__init__.cpython-34.pyc b/cotisations/migrations/__pycache__/__init__.cpython-34.pyc new file mode 100644 index 0000000000000000000000000000000000000000..ab177145c29fd58c13379b88d902af3888d7530f GIT binary patch literal 131 zcmaFI!^_n-wLF{w2p)q77+?f49Dul(1xTbYFa&Ed`mJOr0tq9CUk3VRiADP5<>mTC zsYdzw$@wLj#fc@E`FX|qxtZxjP-c95W?p7Ve7s&k + {% csrf_token %} + {% bootstrap_form factureform %} + {% bootstrap_button "Créer ou modifier" button_type="submit" icon="star" %} + +{% endblock %} diff --git a/cotisations/templates/cotisations/index.html b/cotisations/templates/cotisations/index.html new file mode 100644 index 00000000..a65b18ed --- /dev/null +++ b/cotisations/templates/cotisations/index.html @@ -0,0 +1,28 @@ +{% extends "cotisations/sidebar.html" %} +{% load bootstrap3 %} + +{% block title %}Facture{% endblock %} + +{% block content %} + + + + + + + + + + + {% for user in users_list %} + + + + + + + + {% endfor %} +
DesignationUtilisateurArticleMoyen de paiementDate
{{ facture_list.name }}{{ facture_list.user }}{{ facture_list.article }}{{ facture_list.paiement }}{{ facture_list.date }}
+{% endblock %} + diff --git a/cotisations/templates/cotisations/sidebar.html b/cotisations/templates/cotisations/sidebar.html new file mode 100644 index 00000000..8894fcbb --- /dev/null +++ b/cotisations/templates/cotisations/sidebar.html @@ -0,0 +1,7 @@ +{% extends "base.html" %} + +{% block sidebar %} +

Créer une facture

+

Editer une facture

+

Liste des factures

+{% endblock %} diff --git a/cotisations/tests.py b/cotisations/tests.py new file mode 100644 index 00000000..7ce503c2 --- /dev/null +++ b/cotisations/tests.py @@ -0,0 +1,3 @@ +from django.test import TestCase + +# Create your tests here. diff --git a/cotisations/urls.py b/cotisations/urls.py new file mode 100644 index 00000000..3c0bbdf7 --- /dev/null +++ b/cotisations/urls.py @@ -0,0 +1,11 @@ +from django.conf.urls import url + +from . import views + +urlpatterns = [ + url(r'^new_facture/(?P[0-9]+)$', views.new_facture, name='new-facture'), + url(r'^edit_facture/(?P[0-9]+)$', views.edit_facture, name='edit-facture'), + url(r'^$', views.index, name='index'), +] + + diff --git a/cotisations/views.py b/cotisations/views.py new file mode 100644 index 00000000..a5fa5549 --- /dev/null +++ b/cotisations/views.py @@ -0,0 +1,41 @@ +# App de gestion des users pour re2o +# Goulven Kermarec, Gabriel Détraz +# Gplv2 +from django.shortcuts import render, redirect +from django.shortcuts import render_to_response, get_object_or_404 +from django.core.context_processors import csrf +from django.template import Context, RequestContext, loader +from django.contrib import messages + +from cotisations.models import NewFactureForm, EditFactureForm, Facture, Article + +def form(ctx, template, request): + c = ctx + c.update(csrf(request)) + return render_to_response(template, c, context_instance=RequestContext(request)) + +def new_facture(request, userid): + facture = Facture.objects.create(user=userid) + facture_form = NewFactureForm(request.POST or None, instance=facture) + if facture_form.is_valid(): + facture_form.save() + messages.success(request, "La facture a été crée") + return redirect("/cotisations/") + return form({'factureform': facture_form}, 'cotisations/facture.html', request) + +def edit_facture(request, factureid): + try: + facture = Facture.objects.get(pk=factureid) + except Facture.DoesNotExist: + messages.error(request, u"Facture inexistante" ) + return redirect("/cotisations/") + facture_form = EditFactureForm(request.POST or None, instance=facture) + if facture_form.is_valid(): + facture_form.save() + messages.success(request, "La facture a bien été modifiée") + return redirect("/cotisations/") + return form({'factureform': facture}, 'cotisations/facture.html', request) + +def index(request): + facture_list = Facture.objects.order_by('pk') + return render(request, 'cotisations/index.html', {'facture_list': facture_list}) diff --git a/re2o/urls.py b/re2o/urls.py index 6bcabc24..89fd34cd 100644 --- a/re2o/urls.py +++ b/re2o/urls.py @@ -22,5 +22,6 @@ urlpatterns = [ url(r'^admin/', include(admin.site.urls)), url(r'^users/', include('users.urls', namespace='users')), url(r'^search/', include('search.urls', namespace='search')), + url(r'^cotisations/', include('cotisations.urls', namespace='cotisations')), #url(r'^logs/', include('logs.urls', namespace='logs')), ]