3
0
Fork 0
mirror of https://github.com/nanoy42/coope synced 2024-12-24 16:03:47 +00:00

Merge branch 'hotfix-3.0.1' into dev

This commit is contained in:
Yoann Pétri 2018-12-14 09:37:47 +01:00
commit f98d524576
7 changed files with 36 additions and 3 deletions

3
CHANGELOG.md Normal file
View file

@ -0,0 +1,3 @@
## v3.0.1
* Fix page inactive
* Fix prix dans les historiques de consommations

View file

@ -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

View file

@ -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"])

View file

@ -0,0 +1,19 @@
{% extends 'base.html' %}
{% block entete %}Site inactif{% endblock %}
{% block navbar %}
<ul>
<li><a href="#first">Site inactif</a></li>
</ul>
{% endblock %}
{% block content %}
<section id="first" class="main">
<header class="major">
<h2>Site inactif</h2>
</header>
<section>
Le site coope.rez est actuellement inactif.<br>
<strong>Raison : {{message}}</strong>
</section>
</section>
{% endblock %}

View file

@ -13,4 +13,5 @@ urlpatterns = [
path('addPaymentMethod', views.addPaymentMethod, name="addPaymentMethod"),
path('editPaymentMethod/<int:pk>', views.editPaymentMethod, name="editPaymentMethod"),
path('deletePaymentMethod/<int:pk>', views.deletePaymentMethod, name="deletePaymentMethod"),
path('inactive', views.inactive, name="inactive"),
]

View file

@ -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})

View file

@ -39,5 +39,5 @@
<li><a href="https://www.facebook.com/coopesmetz/" class="icon fa-facebook alt"><span class="label">Facebook</span></a></li>
</ul>
</section>
<p class="copyright">coope.rez v3.0 (release stable) &copy; 2018 Yoann Pietri.</p>
<p class="copyright">coope.rez v3.0.1 (release stable) &copy; 2018 Yoann Pietri.</p>