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