Merge pull request '# 62 404 and 500' (#66) from 62_custom_404_500 into master

Reviewed-on: SGD-Nord/konova#66
This commit is contained in:
Michel Peltriaux 2022-01-12 16:46:52 +01:00
commit b614d00bb0
6 changed files with 92 additions and 20 deletions

View File

@ -57,4 +57,7 @@ urlpatterns = [
if DEBUG:
urlpatterns += [
path('__debug__/', include(debug_toolbar.urls)),
]
]
handler404 = "konova.views.get_404_view"
handler500 = "konova.views.get_500_view"

View File

@ -113,4 +113,31 @@ def remove_deadline_view(request: HttpRequest, id:str):
return form.process_request(
request,
msg_success=_("Deadline removed")
)
)
def get_404_view(request: HttpRequest, exception=None):
""" Returns a 404 handling view
Args:
request ():
exception ():
Returns:
"""
context = BaseContext.context
return render(request, "404.html", context, status=404)
def get_500_view(request: HttpRequest):
""" Returns a 404 handling view
Args:
request ():
Returns:
"""
context = BaseContext.context
return render(request, "500.html", context, status=500)

Binary file not shown.

View File

@ -26,7 +26,7 @@ msgid ""
msgstr ""
"Project-Id-Version: PACKAGE VERSION\n"
"Report-Msgid-Bugs-To: \n"
"POT-Creation-Date: 2022-01-12 15:43+0100\n"
"POT-Creation-Date: 2022-01-12 16:43+0100\n"
"PO-Revision-Date: YEAR-MO-DA HO:MI+ZONE\n"
"Last-Translator: FULL NAME <EMAIL@ADDRESS>\n"
"Language-Team: LANGUAGE <LL@li.org>\n"
@ -1064,7 +1064,7 @@ msgid "Compensation {} edited"
msgstr "Kompensation {} bearbeitet"
#: compensation/views/compensation.py:230 compensation/views/eco_account.py:309
#: ema/views.py:183 intervention/views.py:477
#: ema/views.py:183 intervention/views.py:478
msgid "Log"
msgstr "Log"
@ -1119,36 +1119,36 @@ msgid "Deduction removed"
msgstr "Abbuchung entfernt"
#: compensation/views/eco_account.py:330 ema/views.py:263
#: intervention/views.py:519
#: intervention/views.py:520
msgid "{} unrecorded"
msgstr "{} entzeichnet"
#: compensation/views/eco_account.py:330 ema/views.py:263
#: intervention/views.py:519
#: intervention/views.py:520
msgid "{} recorded"
msgstr "{} verzeichnet"
#: compensation/views/eco_account.py:531 intervention/views.py:500
#: compensation/views/eco_account.py:531 intervention/views.py:501
msgid "Deduction added"
msgstr "Abbuchung hinzugefügt"
#: compensation/views/eco_account.py:616 ema/views.py:520
#: intervention/views.py:375
#: intervention/views.py:376
msgid "{} has already been shared with you"
msgstr "{} wurde bereits für Sie freigegeben"
#: compensation/views/eco_account.py:621 ema/views.py:525
#: intervention/views.py:380
#: intervention/views.py:381
msgid "{} has been shared with you"
msgstr "{} ist nun für Sie freigegeben"
#: compensation/views/eco_account.py:628 ema/views.py:532
#: intervention/views.py:387
#: intervention/views.py:388
msgid "Share link invalid"
msgstr "Freigabelink ungültig"
#: compensation/views/eco_account.py:651 ema/views.py:555
#: intervention/views.py:410
#: intervention/views.py:411
msgid "Share settings updated"
msgstr "Freigabe Einstellungen aktualisiert"
@ -1463,31 +1463,31 @@ msgstr ""
msgid "Intervention {} added"
msgstr "Eingriff {} hinzugefügt"
#: intervention/views.py:245
#: intervention/views.py:246
msgid "This intervention has {} revocations"
msgstr "Dem Eingriff liegen {} Widersprüche vor"
#: intervention/views.py:293
#: intervention/views.py:294
msgid "Intervention {} edited"
msgstr "Eingriff {} bearbeitet"
#: intervention/views.py:328
#: intervention/views.py:329
msgid "{} removed"
msgstr "{} entfernt"
#: intervention/views.py:349
#: intervention/views.py:350
msgid "Revocation removed"
msgstr "Widerspruch entfernt"
#: intervention/views.py:431
#: intervention/views.py:432
msgid "Check performed"
msgstr "Prüfung durchgeführt"
#: intervention/views.py:453
#: intervention/views.py:454
msgid "Revocation added"
msgstr "Widerspruch hinzugefügt"
#: intervention/views.py:524
#: intervention/views.py:525
msgid "There are errors on this intervention:"
msgstr "Es liegen Fehler in diesem Eingriff vor:"
@ -1891,6 +1891,22 @@ msgstr "Alle"
msgid "News"
msgstr "Neuigkeiten"
#: templates/404.html:7
msgid "Not found"
msgstr "Nicht gefunden"
#: templates/404.html:10
msgid "The requested data does not exist."
msgstr "Die angeforderten Daten existieren nicht."
#: templates/500.html:7
msgid "Server Error"
msgstr ""
#: templates/500.html:10
msgid "Something happened. We are working on it!"
msgstr "Irgendetwas ist passiert. Wir arbeiten daran!"
#: templates/email/checking/shared_data_checked.html:4
msgid "Shared data checked"
msgstr "Freigegebene Daten geprüft"
@ -1913,8 +1929,8 @@ msgid ""
"This means, the responsible registration office just confirmed the "
"correctness of this dataset."
msgstr ""
"Das bedeutet, dass die zuständige Zulassungsbehörde die Korrektheit des Datensatzes "
"soeben bestätigt hat."
"Das bedeutet, dass die zuständige Zulassungsbehörde die Korrektheit des "
"Datensatzes soeben bestätigt hat."
#: templates/email/checking/shared_data_checked.html:17
#: templates/email/deleting/shared_data_deleted.html:17

13
templates/404.html Normal file
View File

@ -0,0 +1,13 @@
{% extends 'public_base.html' %}
{% load i18n fontawesome_5 %}
{% block body %}
<div class="jumbotron">
<h1 class="display-4">{% fa5_icon 'question-circle' %} 404</h1>
<h1 class="display-4">{% trans 'Not found' %}</h1>
<hr>
<p class="lead">
{% trans 'The requested data does not exist.' %}
</p>
</div>
{% endblock %}

13
templates/500.html Normal file
View File

@ -0,0 +1,13 @@
{% extends 'public_base.html' %}
{% load i18n fontawesome_5 %}
{% block body %}
<div class="jumbotron">
<h1 class="display-4">{% fa5_icon 'fire-extinguisher' %} {% fa5_icon 'fire-alt' %} 500</h1>
<h1 class="display-4">{% trans 'Server Error' %}</h1>
<hr>
<p class="lead">
{% trans 'Something happened. We are working on it!' %}
</p>
</div>
{% endblock %}