Merge branch 'master' of ssh://willipink.eu:3456/moritz/coinmanager

This commit is contained in:
willipink 2020-06-19 11:29:57 +00:00
commit dd60c3ed52
6 changed files with 24 additions and 8 deletions

View File

@ -1,5 +1,10 @@
{% if single_country %}{% include 'header.html' with title=country.name %} {% if single_country %}{% include 'header.html' with title=country.name %}{% endif %}
{% include 'coinc/controlbar.html' with users=users %}{% 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"> <div class="container-fluid">
<table name="{{ country.name_iso }}"> <table name="{{ country.name_iso }}">
<thead> <thead>

View File

@ -4,4 +4,4 @@
{% include 'coinc/filter_country.html' with countrys=countrys %} {% include 'coinc/filter_country.html' with countrys=countrys %}
{% else %} {% else %}
<p>Trage zuerst Länder im Adminbereich ein.</p>{% endif %} <p>Trage zuerst Länder im Adminbereich ein.</p>{% endif %}
{% include 'footer.html' with title='Münzsammlung' %} {% include 'footer.html' %}

View File

@ -26,8 +26,7 @@ from . import views
app_name = 'coinc' app_name = 'coinc'
urlpatterns = [ urlpatterns = [
path('', views.index, name='index'), 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('<str:name_iso>', views.detail_country, name='country'),
path('add/user/<str:username>/color/<str:color>', views.add_user, name='add_user'), 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') ]
]

View File

@ -20,6 +20,7 @@
from datetime import datetime, date from datetime import datetime, date
from json import dumps from json import dumps
from django.conf import settings
from django.http import HttpResponse, Http404 from django.http import HttpResponse, Http404
from django.template import loader from django.template import loader
from django.template.defaultfilters import register from django.template.defaultfilters import register
@ -72,10 +73,18 @@ def detail_country(request, name_iso):
try: try:
country = Country.objects.get(name_iso=name_iso) country = Country.objects.get(name_iso=name_iso)
except Country.DoesNotExist: 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) 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)) return HttpResponse(template.render(context, request))

View File

@ -119,3 +119,6 @@ USE_TZ = True
# https://docs.djangoproject.com/en/3.0/howto/static-files/ # https://docs.djangoproject.com/en/3.0/howto/static-files/
STATIC_URL = '/static/' STATIC_URL = '/static/'
# Maintenance Mode
MAINTENANCE_MODE_READ_ONLY = True

2
update
View File

@ -3,7 +3,7 @@
set -e set -e
echo "cloning ..." echo "cloning ..."
git pull origin master >/dev/null git pull -q origin master >/dev/null
echo "collecting ..." echo "collecting ..."