Skip to content
Snippets Groups Projects
Verified Commit 70fc9b78 authored by Nik | Klampfradler's avatar Nik | Klampfradler
Browse files

Remove unnecessary error handler; align and complete error templates.

parent f35c179b
No related branches found
No related tags found
No related merge requests found
{% extends "core/base.html" %}
{% load bootstrap4 i18n staticfiles %}
{% load i18n %}
{% block page_title %}
{% blocktrans %}Forbidden{% endblocktrans %}
{% endblock %}
{% block content %}
<div class="jumbotron jumbotron-fluid">
<div class="container">
<h1>{{ status }} - {{ caption }}</h1>
<p class="lead">
{{ message }}
{{ exception|default:_('You are not allowed to access the requested page or object.') }}
</p>
<hr />
<p>
{% blocktrans %}
If you think this is an error in BiscuIT, please contact one of your
site administrators:
If you think this is an error in BiscuIT, please contact your site
administrators.
{% endblocktrans %}
</p>
<ul>
......
{% extends "core/base.html" %}
{% load i18n %}
{% block page_title %}
{% blocktrans %}Not found{% endblocktrans %}
{% endblock %}
{% block content %}
<div class="jumbotron jumbotron-fluid">
<div class="container">
<p class="lead">
{{ exception|default:_('The requested page or object was not found.') }}
</p>
<hr />
<p>
{% blocktrans %}
If you were redirected by a link on an external page,
it is possible that that link was outdated.
{% endblocktrans %}
{% blocktrans %}
If you think this is an error in BiscuIT, please contact your site
administrators.
{% endblocktrans %}
</p>
<ul>
{% for admin in ADMINS %}
<li>
{{ admin.0 }}
&lt;
<a href="mailto:{{ admin.1 }}">
{{ admin.1 }}
</a>
&gt;
</li>
{% endfor %}
</ul>
</div>
</div>
{% endblock %}
{% extends "core/base.html" %}
{% load i18n %}
{% block page_title %}
{% blocktrans %}Internal Server Error{% endblocktrans %}
{% endblock %}
{% block content %}
<div class="jumbotron jumbotron-fluid">
<div class="container">
<p class="lead">
{% blocktrans %}
An unexpected error has occured.
{% endblocktrans %}
</p>
<hr />
<p>
{% blocktrans %}
Your site administrators will automatically be notified about this
error.
{% endblocktrans %}
</p>
</div>
</div>
{% endblock %}
{% extends "core/base.html" %}
{% load bootstrap4 i18n staticfiles %}
{% load i18n %}
{% block page_title %}
{% blocktrans %}Maintenance mode{% endblocktrans %}
{% endblock %}
{% block content %}
<div class="jumbotron jumbotron-fluid">
<div class="container">
<h1>503 - Maintenance mode</h1>
<p class="lead">
{% blocktrans %}
The maintenance mode is currently enabled. Please try again later.
......
......@@ -30,10 +30,6 @@ urlpatterns = [
path('__i18n__/', include('django.conf.urls.i18n'))
]
# Custom error pages
handler404 = views.error_handler(404)
handler500 = views.error_handler(500)
# Serve javascript-common if in development
if settings.DEBUG:
urlpatterns += static('/javascript/',
......
......@@ -18,25 +18,6 @@ def index(request: HttpRequest) -> HttpResponse:
return render(request, 'core/index.html', context)
def error_handler(status: int) -> Callable[..., HttpResponse]:
def real_handler(request: HttpRequest, *args, **kwargs) -> HttpResponse:
context = {}
context['status'] = status
if status == 404:
context['message'] = _(
'This page does not exist. If you were redirected by a link on an external page, it is possible that that link was outdated.')
context['caption'] = _('Page not found')
elif status == 500:
context['caption'] = _('Internal server error')
context['message'] = _('An unexpected error has occurred.')
return render(request, 'core/error.html', context, status=status)
return real_handler
@login_required
def persons(request: HttpRequest) -> HttpResponse:
context = {}
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment