Add error pages
This commit is contained in:
parent
026ea5f834
commit
fb6e703b67
21
pflaenzli/pflaenzli/templates/error/404.html
Normal file
21
pflaenzli/pflaenzli/templates/error/404.html
Normal file
|
@ -0,0 +1,21 @@
|
|||
{% extends 'base.html' %}
|
||||
{% load i18n %}
|
||||
{% block title %}
|
||||
{% trans "Not found" %}
|
||||
{% endblock title %}
|
||||
{% block content %}
|
||||
<div>
|
||||
<h1 class="mb-5">
|
||||
<span class="badge bg-danger">Error 404</span> {% trans "Page not found" %}
|
||||
</h1>
|
||||
<p class="mb-5 blockquote w-75 m-auto">
|
||||
{% blocktrans %}
|
||||
Alas! Your path has led you astray in the depths of the enchanted forest. The elusive plant you seek has hidden
|
||||
itself amidst the mystical foliage. If you have a map, please share it with us!
|
||||
{% endblocktrans %}
|
||||
</p>
|
||||
<h2>{% trans "What now?" %}</h2>
|
||||
<a href="{% url 'index' %}" class="btn btn-pfl">{% trans "Go home" %}</a>
|
||||
<a href="mailto:contact@pflaenz.li" class="btn btn-secondary">{% trans "Report error" %}</a>
|
||||
</div>
|
||||
{% endblock content %}
|
23
pflaenzli/pflaenzli/templates/error/500.html
Normal file
23
pflaenzli/pflaenzli/templates/error/500.html
Normal file
|
@ -0,0 +1,23 @@
|
|||
{% extends 'base.html' %}
|
||||
{% load i18n %}
|
||||
{% block title %}
|
||||
{% trans "Not found" %}
|
||||
{% endblock title %}
|
||||
{% block content %}
|
||||
<div>
|
||||
<h1 class="mb-3">
|
||||
<span class="badge bg-danger">Error 500</span> {% trans "Page not found" %}
|
||||
</h1>
|
||||
<p class="mb-5 blockquote w-75">
|
||||
{% blocktrans %}
|
||||
Uh-oh! The delicate balance of the botanical realms has been disrupted. The forces of nature are in disarray,
|
||||
and our plant guardians are diligently working to restore harmony. We apologize for any inconvenience caused
|
||||
during this mystical turbulence. Please bear with us as we channel our magic to mend the rupture. Please
|
||||
contact us, if you have any information that could help to disspell the dark magic!
|
||||
{% endblocktrans %}
|
||||
</p>
|
||||
<h2>{% trans "What now?" %}</h2>
|
||||
<a href="{% url 'index' %}" class="btn btn-pfl">{% trans "Go home" %}</a>
|
||||
<a href="mailto:contact@pflaenz.li" class="btn btn-secondary">{% trans "Report error" %}</a>
|
||||
</div>
|
||||
{% endblock content %}
|
|
@ -182,7 +182,14 @@ def register_user(request):
|
|||
else:
|
||||
form = RegistrationForm()
|
||||
|
||||
return render(request, "basic_form.html", {"form": form, "button_label": _("Register"), "title": _("Registeration")})
|
||||
|
||||
|
||||
def error_404(request, exception):
|
||||
return render(request, 'error/404.html')
|
||||
|
||||
|
||||
def error_500(request):
|
||||
return render(request, 'error/500.html')
|
||||
|
||||
|
||||
def filter_offers(offers, form):
|
||||
|
|
|
@ -26,3 +26,6 @@ urlpatterns = [
|
|||
]
|
||||
urlpatterns += static(settings.STATIC_URL, document_root=settings.STATIC_ROOT)
|
||||
urlpatterns += static(settings.MEDIA_URL, document_root=settings.MEDIA_ROOT)
|
||||
|
||||
handler404 = 'pflaenzli.views.error_404'
|
||||
handler500 = 'pflaenzli.views.error_500'
|
||||
|
|
Loading…
Reference in a new issue