# 62 404 and 500

* adds custom 404 and 500 error handling views
* adds/updates translations
This commit is contained in:
mpeltriaux 2022-01-12 16:45:55 +01:00
parent 6342044ff9
commit a9962b4d20
6 changed files with 92 additions and 20 deletions

View File

@ -57,4 +57,7 @@ urlpatterns = [
if DEBUG: if DEBUG:
urlpatterns += [ urlpatterns += [
path('__debug__/', include(debug_toolbar.urls)), 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( return form.process_request(
request, request,
msg_success=_("Deadline removed") 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 "" msgstr ""
"Project-Id-Version: PACKAGE VERSION\n" "Project-Id-Version: PACKAGE VERSION\n"
"Report-Msgid-Bugs-To: \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" "PO-Revision-Date: YEAR-MO-DA HO:MI+ZONE\n"
"Last-Translator: FULL NAME <EMAIL@ADDRESS>\n" "Last-Translator: FULL NAME <EMAIL@ADDRESS>\n"
"Language-Team: LANGUAGE <LL@li.org>\n" "Language-Team: LANGUAGE <LL@li.org>\n"
@ -1064,7 +1064,7 @@ msgid "Compensation {} edited"
msgstr "Kompensation {} bearbeitet" msgstr "Kompensation {} bearbeitet"
#: compensation/views/compensation.py:230 compensation/views/eco_account.py:309 #: 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" msgid "Log"
msgstr "Log" msgstr "Log"
@ -1119,36 +1119,36 @@ msgid "Deduction removed"
msgstr "Abbuchung entfernt" msgstr "Abbuchung entfernt"
#: compensation/views/eco_account.py:330 ema/views.py:263 #: compensation/views/eco_account.py:330 ema/views.py:263
#: intervention/views.py:519 #: intervention/views.py:520
msgid "{} unrecorded" msgid "{} unrecorded"
msgstr "{} entzeichnet" msgstr "{} entzeichnet"
#: compensation/views/eco_account.py:330 ema/views.py:263 #: compensation/views/eco_account.py:330 ema/views.py:263
#: intervention/views.py:519 #: intervention/views.py:520
msgid "{} recorded" msgid "{} recorded"
msgstr "{} verzeichnet" 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" msgid "Deduction added"
msgstr "Abbuchung hinzugefügt" msgstr "Abbuchung hinzugefügt"
#: compensation/views/eco_account.py:616 ema/views.py:520 #: 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" msgid "{} has already been shared with you"
msgstr "{} wurde bereits für Sie freigegeben" msgstr "{} wurde bereits für Sie freigegeben"
#: compensation/views/eco_account.py:621 ema/views.py:525 #: compensation/views/eco_account.py:621 ema/views.py:525
#: intervention/views.py:380 #: intervention/views.py:381
msgid "{} has been shared with you" msgid "{} has been shared with you"
msgstr "{} ist nun für Sie freigegeben" msgstr "{} ist nun für Sie freigegeben"
#: compensation/views/eco_account.py:628 ema/views.py:532 #: compensation/views/eco_account.py:628 ema/views.py:532
#: intervention/views.py:387 #: intervention/views.py:388
msgid "Share link invalid" msgid "Share link invalid"
msgstr "Freigabelink ungültig" msgstr "Freigabelink ungültig"
#: compensation/views/eco_account.py:651 ema/views.py:555 #: compensation/views/eco_account.py:651 ema/views.py:555
#: intervention/views.py:410 #: intervention/views.py:411
msgid "Share settings updated" msgid "Share settings updated"
msgstr "Freigabe Einstellungen aktualisiert" msgstr "Freigabe Einstellungen aktualisiert"
@ -1463,31 +1463,31 @@ msgstr ""
msgid "Intervention {} added" msgid "Intervention {} added"
msgstr "Eingriff {} hinzugefügt" msgstr "Eingriff {} hinzugefügt"
#: intervention/views.py:245 #: intervention/views.py:246
msgid "This intervention has {} revocations" msgid "This intervention has {} revocations"
msgstr "Dem Eingriff liegen {} Widersprüche vor" msgstr "Dem Eingriff liegen {} Widersprüche vor"
#: intervention/views.py:293 #: intervention/views.py:294
msgid "Intervention {} edited" msgid "Intervention {} edited"
msgstr "Eingriff {} bearbeitet" msgstr "Eingriff {} bearbeitet"
#: intervention/views.py:328 #: intervention/views.py:329
msgid "{} removed" msgid "{} removed"
msgstr "{} entfernt" msgstr "{} entfernt"
#: intervention/views.py:349 #: intervention/views.py:350
msgid "Revocation removed" msgid "Revocation removed"
msgstr "Widerspruch entfernt" msgstr "Widerspruch entfernt"
#: intervention/views.py:431 #: intervention/views.py:432
msgid "Check performed" msgid "Check performed"
msgstr "Prüfung durchgeführt" msgstr "Prüfung durchgeführt"
#: intervention/views.py:453 #: intervention/views.py:454
msgid "Revocation added" msgid "Revocation added"
msgstr "Widerspruch hinzugefügt" msgstr "Widerspruch hinzugefügt"
#: intervention/views.py:524 #: intervention/views.py:525
msgid "There are errors on this intervention:" msgid "There are errors on this intervention:"
msgstr "Es liegen Fehler in diesem Eingriff vor:" msgstr "Es liegen Fehler in diesem Eingriff vor:"
@ -1891,6 +1891,22 @@ msgstr "Alle"
msgid "News" msgid "News"
msgstr "Neuigkeiten" 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 #: templates/email/checking/shared_data_checked.html:4
msgid "Shared data checked" msgid "Shared data checked"
msgstr "Freigegebene Daten geprüft" msgstr "Freigegebene Daten geprüft"
@ -1913,8 +1929,8 @@ msgid ""
"This means, the responsible registration office just confirmed the " "This means, the responsible registration office just confirmed the "
"correctness of this dataset." "correctness of this dataset."
msgstr "" msgstr ""
"Das bedeutet, dass die zuständige Zulassungsbehörde die Korrektheit des Datensatzes " "Das bedeutet, dass die zuständige Zulassungsbehörde die Korrektheit des "
"soeben bestätigt hat." "Datensatzes soeben bestätigt hat."
#: templates/email/checking/shared_data_checked.html:17 #: templates/email/checking/shared_data_checked.html:17
#: templates/email/deleting/shared_data_deleted.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 %}