diff --git a/coinmanager/coinc/templates/coinc/country.html b/coinmanager/coinc/templates/coinc/country.html index 27992f5..bbb18c4 100644 --- a/coinmanager/coinc/templates/coinc/country.html +++ b/coinmanager/coinc/templates/coinc/country.html @@ -1,5 +1,10 @@ -{% if single_country %}{% include 'header.html' with title=country.name %} -{% include 'coinc/controlbar.html' with users=users %}{% endif %} +{% if single_country %}{% include 'header.html' with title=country.name %}{% endif %} +{% if maintenance_mode %} +
+

Wartungsarbeiten

+

Es können im Moment keine Änderungen an der Münztabelle vorgenommen werden

+
+{% elif logged_in %}{% include 'coinc/controlbar.html' with users=users %}{% endif %}
diff --git a/coinmanager/coinc/templates/coinc/index.html b/coinmanager/coinc/templates/coinc/index.html index d44666b..c97bc28 100644 --- a/coinmanager/coinc/templates/coinc/index.html +++ b/coinmanager/coinc/templates/coinc/index.html @@ -4,4 +4,4 @@ {% include 'coinc/filter_country.html' with countrys=countrys %} {% else %}

Trage zuerst Länder im Adminbereich ein.

{% endif %} -{% include 'footer.html' with title='Münzsammlung' %} +{% include 'footer.html' %} diff --git a/coinmanager/coinc/urls.py b/coinmanager/coinc/urls.py index ad5642d..46eb863 100644 --- a/coinmanager/coinc/urls.py +++ b/coinmanager/coinc/urls.py @@ -26,8 +26,7 @@ from . import views app_name = 'coinc' urlpatterns = [ path('', views.index, name='index'), - path('statistik', views.statistic, name='statistic'), + #path('statistik', views.statistic, name='statistic'), path('', views.detail_country, name='country'), path('add/user//color/', views.add_user, name='add_user'), - path('add/coin', views.add_coin, name='add_coin') -] + path('add/coin', views.add_coin, name='add_coin') ] diff --git a/coinmanager/coinc/views.py b/coinmanager/coinc/views.py index 381066c..cfbb917 100644 --- a/coinmanager/coinc/views.py +++ b/coinmanager/coinc/views.py @@ -20,6 +20,7 @@ from datetime import datetime, date from json import dumps +from django.conf import settings from django.http import HttpResponse, Http404 from django.template import loader from django.template.defaultfilters import register @@ -72,10 +73,18 @@ def detail_country(request, name_iso): try: country = Country.objects.get(name_iso=name_iso) except Country.DoesNotExist: - raise Http404(f"Das Land '{name_iso}' ist nicht vorhanden") + raise Http404(f"Das Land '{name_iso}' existiert nicht.") context = show_country(country, single_country=True) + password = 'foobar' + password_try = request.GET.get('p', '') + if password_try == password: + if settings.MAINTENANCE_MODE_READ_ONLY: + context['maintenance_mode'] = True + else: + context['logged_in'] = True + return HttpResponse(template.render(context, request)) diff --git a/coinmanager/coinmanager/settings.py b/coinmanager/coinmanager/settings.py index 1c45772..878b25e 100644 --- a/coinmanager/coinmanager/settings.py +++ b/coinmanager/coinmanager/settings.py @@ -119,3 +119,6 @@ USE_TZ = True # https://docs.djangoproject.com/en/3.0/howto/static-files/ STATIC_URL = '/static/' + +# Maintenance Mode +MAINTENANCE_MODE_READ_ONLY = True