add maintenance mode and beginning of login mechanism
This commit is contained in:
parent
e2e2f5c3df
commit
21b02d3998
@ -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 %}
|
||||
<div class="alert alert-warning">
|
||||
<h4 class="alert-heading">Wartungsarbeiten</h4>
|
||||
<p class="mb-0">Es können im Moment keine Änderungen an der Münztabelle vorgenommen werden</p>
|
||||
</div>
|
||||
{% elif logged_in %}{% include 'coinc/controlbar.html' with users=users %}{% endif %}
|
||||
<div class="container-fluid">
|
||||
<table name="{{ country.name_iso }}">
|
||||
<thead>
|
||||
|
@ -4,4 +4,4 @@
|
||||
{% include 'coinc/filter_country.html' with countrys=countrys %}
|
||||
{% else %}
|
||||
<p>Trage zuerst Länder im Adminbereich ein.</p>{% endif %}
|
||||
{% include 'footer.html' with title='Münzsammlung' %}
|
||||
{% include 'footer.html' %}
|
||||
|
@ -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('<str:name_iso>', views.detail_country, name='country'),
|
||||
path('add/user/<str:username>/color/<str: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') ]
|
||||
|
@ -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))
|
||||
|
||||
|
||||
|
@ -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
|
||||
|
Loading…
x
Reference in New Issue
Block a user