diff --git a/district/models.py b/district/models.py index 59255f80ab7680a259f092643435b4e07f85653d..e683c413f181c0a72beb0bc4e462a214daf62068 100644 --- a/district/models.py +++ b/district/models.py @@ -2,6 +2,7 @@ import random from django.core.paginator import Paginator from django.db import models +from django.shortcuts import render from django.utils.translation import gettext_lazy from modelcluster.contrib.taggit import ClusterTaggableManager from modelcluster.fields import ParentalKey @@ -219,6 +220,10 @@ class DistrictHomePage(MetadataPageMixin, CalendarMixin, Page): def election_page(self): return self._first_subpage_of_type(DistrictElectionPage) + @staticmethod + def get_404_response(request): + return render(request, "district/404.html", status=404) + @property def people_page(self): return self._first_subpage_of_type(DistrictPeoplePage) diff --git a/district/templates/district/404.html b/district/templates/district/404.html new file mode 100644 index 0000000000000000000000000000000000000000..e7455978382e73cc6908b878f81c6a8f67012aff --- /dev/null +++ b/district/templates/district/404.html @@ -0,0 +1,25 @@ +{#{% extends 'district/base.html' %} radši ne-extendujeme base, aby nezklouzlo na 500 v případě nějakého problému #} +{% load static %} + +<html lang="cs"> + <head> + <link rel="stylesheet" href="{% static 'styleguide18/assets/css/styles.css' %}"> + <title>404</title> + </head> + <body> + {# {% block content %}#} + <div class="flex flex-col my-40 items-center"> + <h1 class="head-alt-lg mb-8"> + 404 + </h1> + <img src="{% static 'shared/img/logo_black.svg' %}" alt class="mb-8"/> + <h1 class="head-alt-md mb-8"> + Narazili jsme na mělčinu... + </h1> + <a href="/"> + Zpět do přístavu + </a> + </div> + {# {% endblock content %}#} + </body> +</html> diff --git a/region/models.py b/region/models.py index 7a894bfad0cb3896b2918c6d22af9c34b5ed989e..2c43c4e0b2639f02b714e06a81e6201f3e30ebcf 100644 --- a/region/models.py +++ b/region/models.py @@ -2,6 +2,7 @@ import random from django.core.paginator import Paginator from django.db import models +from django.shortcuts import render from django.utils.translation import gettext_lazy from modelcluster.contrib.taggit import ClusterTaggableManager from modelcluster.fields import ParentalKey @@ -219,6 +220,10 @@ class RegionHomePage(MetadataPageMixin, CalendarMixin, Page): def election_page(self): return self._first_subpage_of_type(RegionElectionPage) + @staticmethod + def get_404_response(request): + return render(request, "region/404.html", status=404) + @property def people_page(self): return self._first_subpage_of_type(RegionPeoplePage) diff --git a/region/templates/region/404.html b/region/templates/region/404.html new file mode 100644 index 0000000000000000000000000000000000000000..c87ff38ef3f6d4596009e4a29b2119089c5ebd0f --- /dev/null +++ b/region/templates/region/404.html @@ -0,0 +1,22 @@ +{% load static %} + +<html lang="cs"> + <head> + <link rel="stylesheet" href="{% static 'styleguide18/assets/css/styles.css' %}"> + <title>404</title> + </head> + <body> + <div class="flex flex-col my-40 items-center"> + <h1 class="head-alt-lg mb-8"> + 404 + </h1> + <img src="{% static 'shared/img/logo_black.svg' %}" alt class="mb-8"/> + <h1 class="head-alt-md mb-8"> + Narazili jsme na mělčinu... + </h1> + <a href="/"> + Zpět do přístavu + </a> + </div> + </body> +</html>