mirror of
https://github.com/nanoy42/coope
synced 2024-12-26 08:53:47 +00:00
parent
dfec4e7b3c
commit
9cfcc7abde
4 changed files with 31 additions and 1 deletions
|
@ -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
|
||||
|
||||
|
|
19
preferences/templates/preferences/inactive.html
Normal file
19
preferences/templates/preferences/inactive.html
Normal 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 %}
|
|
@ -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"),
|
||||
]
|
||||
|
|
|
@ -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})
|
||||
|
Loading…
Reference in a new issue