From dfec4e7b3ceb26c2d07f4f491317ecdd09dba236 Mon Sep 17 00:00:00 2001 From: nanoy Date: Fri, 14 Dec 2018 09:01:16 +0100 Subject: [PATCH 1/3] Bon prix dans les historiques de consommation Close #4 --- gestion/views.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/gestion/views.py b/gestion/views.py index c2677f7..b0832d7 100644 --- a/gestion/views.py +++ b/gestion/views.py @@ -158,7 +158,7 @@ def order(request): consumption, _ = Consumption.objects.get_or_create(customer=user, product=product) consumption.quantity += quantity consumption.save() - ch = ConsumptionHistory(customer = user, quantity = quantity, paymentMethod=paymentMethod, product=product, amount=int(quantity*product.amount), coopeman=request.user) + ch = ConsumptionHistory(customer=user, quantity=quantity, paymentMethod=paymentMethod, product=product, amount=Decimal(quantity*product.amount), coopeman=request.user) ch.save() for m in menus: menu = get_object_or_404(Menu, pk=m["pk"]) From 9cfcc7abde7e911e9db6458b1c1860886ca56747 Mon Sep 17 00:00:00 2001 From: nanoy Date: Fri, 14 Dec 2018 09:17:56 +0100 Subject: [PATCH 2/3] Fix site inactif Close #7 --- coopeV3/acl.py | 2 +- .../templates/preferences/inactive.html | 19 +++++++++++++++++++ preferences/urls.py | 1 + preferences/views.py | 10 ++++++++++ 4 files changed, 31 insertions(+), 1 deletion(-) create mode 100644 preferences/templates/preferences/inactive.html diff --git a/coopeV3/acl.py b/coopeV3/acl.py index f971e38..9539565 100644 --- a/coopeV3/acl.py +++ b/coopeV3/acl.py @@ -35,7 +35,7 @@ def active_required(view): def wrapper(request, *args, **kwargs): gp,_ = GeneralPreferences.objects.get_or_create(pk=1) if(not gp.is_active): - return redirect(reverse('preferences:inactif')) + return redirect(reverse('preferences:inactive')) return view(request, *args, **kwargs) return wrapper diff --git a/preferences/templates/preferences/inactive.html b/preferences/templates/preferences/inactive.html new file mode 100644 index 0000000..4855067 --- /dev/null +++ b/preferences/templates/preferences/inactive.html @@ -0,0 +1,19 @@ +{% extends 'base.html' %} +{% block entete %}Site inactif{% endblock %} +{% block navbar %} + +{% endblock %} +{% block content %} +
+
+

Site inactif

+
+
+ Le site coope.rez est actuellement inactif.
+ + Raison : {{message}} +
+
+{% endblock %} diff --git a/preferences/urls.py b/preferences/urls.py index e45f5b4..7981698 100644 --- a/preferences/urls.py +++ b/preferences/urls.py @@ -13,4 +13,5 @@ urlpatterns = [ path('addPaymentMethod', views.addPaymentMethod, name="addPaymentMethod"), path('editPaymentMethod/', views.editPaymentMethod, name="editPaymentMethod"), path('deletePaymentMethod/', views.deletePaymentMethod, name="deletePaymentMethod"), + path('inactive', views.inactive, name="inactive"), ] diff --git a/preferences/views.py b/preferences/views.py index a832db2..08c8976 100644 --- a/preferences/views.py +++ b/preferences/views.py @@ -229,3 +229,13 @@ def deletePaymentMethod(request,pk): paymentMethod.delete() messages.success(request, message) return redirect(reverse('preferences:paymentMethodsIndex')) + +########## Active Site ########## + +def inactive(request): + """ + Displays inactive view + """ + gp, _ = GeneralPreferences.objects.get_or_create(pk=1) + return render(request, 'preferences/inactive.html', {"message": gp.active_message}) + \ No newline at end of file From 1e462fd81b28530d05501494539105bc27fff820 Mon Sep 17 00:00:00 2001 From: nanoy Date: Fri, 14 Dec 2018 09:32:30 +0100 Subject: [PATCH 3/3] Hotfix 3.0.1 --- CHANGELOG.md | 3 +++ templates/footer.html | 2 +- 2 files changed, 4 insertions(+), 1 deletion(-) create mode 100644 CHANGELOG.md diff --git a/CHANGELOG.md b/CHANGELOG.md new file mode 100644 index 0000000..fcfd6d7 --- /dev/null +++ b/CHANGELOG.md @@ -0,0 +1,3 @@ +## v3.0.1 +* Fix page inactive +* Fix prix dans les historiques de consommations \ No newline at end of file diff --git a/templates/footer.html b/templates/footer.html index a0ffad0..37254c6 100644 --- a/templates/footer.html +++ b/templates/footer.html @@ -39,5 +39,5 @@
  • Facebook
  • - +