Page not found and 404 templates

This commit is contained in:
Oleg Lavrovsky 2017-07-06 15:51:05 +02:00
parent 021f7823f5
commit 47bb705502
4 changed files with 68 additions and 4 deletions

View file

@ -127,6 +127,7 @@ AUTH_PASSWORD_VALIDATORS = [
}, },
] ]
PASSWORD_REQUIRED_TEMPLATE = 'password.html'
# Internationalization # Internationalization
# https://docs.djangoproject.com/en/1.8/topics/i18n/ # https://docs.djangoproject.com/en/1.8/topics/i18n/

View file

@ -1,11 +1,35 @@
{% extends "base.html" %} {% extends "base.html" %}
{% block title %}404 - Page not found{% endblock %} {% block title %}404 - Seite nicht gefunden{% endblock %}
{% block body_class %}template-404{% endblock %} {% block body_class %}template-404{% endblock %}
{% block content %} {% block content %}
<h1>Page not found</h1> <section>
<div class="container">
<h2>Sorry, this page could not be found.</h2> <h1>Nicht gefunden/Introuvable</h1>
<center>
<!-- Search form -->
<form action="/search/" method="get">
<input type="text" name="query" value="" id="search-form-404" class="form-control">
<button type="submit" title="Search">
<span class="glyphicon glyphicon-search" aria-hidden="false"></span>
</button>
</form>
<em><p>
<br>Diese Seite konnte nicht gefunden werden. Möchten Sie eine Suche starten?
<br>Désolé, cette page est introuvable. Voulez-vous faire une recherche sur le site?
<br>Sorry, this page could not be found. Would you like to do a search of the site?
</p></em>
</center>
</div>
</section>
<script>
document.getElementById('search-form-404').value = document.location.pathname.split('/')[2];
</script>
{% endblock %} {% endblock %}

View file

@ -0,0 +1,39 @@
{% extends "base.html" %}
{% block title %}Password Required{% endblock %}
{% block body_class %}password-required{% endblock %}
{% block content %}
<section>
<div class="container">
<h1>Password requis/erforderlich</h1>
<center>
<form action="{{ action_url }}" method="POST">
{% csrf_token %}
{{ form.non_field_errors }}
<div>
{{ form.password.errors }}
{{ form.password }}
</div>
{% for field in form.hidden_fields %}
{{ field }}
{% endfor %}
<input type="submit" value="Continue/Fortfahren" />
</form>
<em><p>
<br>Sie benötigen ein Passwort, um auf diese Seite zuzugreifen.
<br>Vous avez besoin d'un mot de passe pour accéder à cette page.
<br>You need a password to access this page.
</p></em>
</center>
</div>
</section>
{% endblock %}

View file

@ -1,4 +1,4 @@
# Updated: 30.5.2017 # Updated: 5.7.2017
# Core # Core
wagtail==1.11 wagtail==1.11