Skip to content

Commit ff63741

Browse files
committed
Added missing error pages.
1 parent 2994170 commit ff63741

File tree

6 files changed

+117
-4
lines changed

6 files changed

+117
-4
lines changed

src/base/views.py

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -5,25 +5,25 @@ class BadRequestErrorView(TemplateView):
55
"""
66
Displays a custom 400 error page when a bad request is made.
77
"""
8-
template_name = '400.html'
8+
template_name = 'http_errors/400.html'
99

1010

1111
class ForbiddenErrorView(TemplateView):
1212
"""
1313
Displays a custom 403 error page when access to a resource is forbidden.
1414
"""
15-
template_name = '403.html'
15+
template_name = 'http_errors/403.html'
1616

1717

1818
class NotFoundErrorView(TemplateView):
1919
"""
2020
Displays a custom 404 error page when a page is not found.
2121
"""
22-
template_name = '404.html'
22+
template_name = 'http_errors/404.html'
2323

2424

2525
class InternalServerErrorView(TemplateView):
2626
"""
2727
Displays a custom 500 error page when an internal server error occurs.
2828
"""
29-
template_name = '500.html'
29+
template_name = 'http_errors/500.html'

src/templates/http_errors/400.html

Lines changed: 16 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,16 @@
1+
{% extends "http_errors/error.html" %}
2+
{% load static %}
3+
{% load i18n %}
4+
5+
{% block content %}
6+
<div class="container">
7+
8+
<section class="section error-404 min-vh-100 d-flex flex-column align-items-center justify-content-center">
9+
<h1>400</h1>
10+
<h2>Sorry, the request could not be understood by the server due to malformed syntax.</h2>
11+
<a class="btn" href="{% url 'signals' %}">Back to home</a>
12+
</section>
13+
14+
</div>
15+
{% endblock %}
16+

src/templates/http_errors/403.html

Lines changed: 13 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,13 @@
1+
{% extends "http_errors/error.html" %}
2+
{% load static %}
3+
{% load i18n %}
4+
5+
{% block content %}
6+
<div class="container">
7+
<section class="section error-404 min-vh-100 d-flex flex-column align-items-center justify-content-center">
8+
<h1>403</h1>
9+
<h2>You don't have permission to access this resource.</h2>
10+
<a class="btn" href="{% url 'signals' %}">Back to home</a>
11+
</section>
12+
</div>
13+
{% endblock %}

src/templates/http_errors/404.html

Lines changed: 15 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,15 @@
1+
{% extends "http_errors/error.html" %}
2+
3+
{% load static %}
4+
5+
{% load i18n %}
6+
7+
{% block content %}
8+
<div class="container">
9+
<section class="section error-404 min-vh-100 d-flex flex-column align-items-center justify-content-center">
10+
<h1>404</h1>
11+
<h2>Not Found</h2>
12+
<a class="btn" href="{% url 'signals' %}">Back to home</a>
13+
</section>
14+
</div>
15+
{% endblock %}

src/templates/http_errors/500.html

Lines changed: 13 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,13 @@
1+
{% extends "http_errors/error.html" %}
2+
{% load static %}
3+
{% load i18n %}
4+
5+
{% block content %}
6+
<div class="container">
7+
<section class="section error-404 min-vh-100 d-flex flex-column align-items-center justify-content-center">
8+
<h1>500</h1>
9+
<h2>Internal Server Error.</h2>
10+
<a class="btn" href="{% url 'signals' %}">Back to home</a>
11+
</section>
12+
</div>
13+
{% endblock %}

src/templates/http_errors/error.html

Lines changed: 56 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,56 @@
1+
{% load static %} {% load i18n %}
2+
3+
<!DOCTYPE html>
4+
<html lang="en">
5+
<head>
6+
<meta charset="utf-8" />
7+
<meta content="width=device-width, initial-scale=1.0" name="viewport" />
8+
9+
<title>Error</title>
10+
<meta content="" name="description" />
11+
<meta content="" name="keywords" />
12+
13+
<link href="{% static 'img/DELPHI-favicon.svg' %}" rel="icon" />
14+
<link
15+
href="{% static 'img/apple-touch-icon.png' %}"
16+
rel="apple-touch-icon"
17+
/>
18+
19+
<link rel="stylesheet" href="{% static 'css/style.css' %}" />
20+
21+
<!-- Font Awesome -->
22+
<link
23+
href="https://cdnjs.cloudflare.com/ajax/libs/font-awesome/6.0.0/css/all.min.css"
24+
rel="stylesheet"
25+
/>
26+
<!-- Google Fonts -->
27+
<link
28+
href="https://fonts.googleapis.com/css?family=Roboto:300,400,500,700&display=swap"
29+
rel="stylesheet"
30+
/>
31+
<!-- MDB -->
32+
<link
33+
href="https://cdnjs.cloudflare.com/ajax/libs/mdb-ui-kit/7.3.2/mdb.min.css"
34+
rel="stylesheet"
35+
/>
36+
37+
<script src="https://ajax.googleapis.com/ajax/libs/jquery/3.5.1/jquery.min.js"></script>
38+
</head>
39+
40+
<body>
41+
<main>
42+
43+
{% block content %}
44+
45+
{% endblock %}
46+
</main>
47+
<!-- End #main -->
48+
49+
<!-- MDB -->
50+
<script
51+
type="text/javascript"
52+
src="https://cdnjs.cloudflare.com/ajax/libs/mdb-ui-kit/7.3.2/mdb.umd.min.js"
53+
></script>
54+
55+
</body>
56+
</html>

0 commit comments

Comments
 (0)