1
0
Fork 0
mirror of https://github.com/Findus23/acronomy.git synced 2024-09-19 15:33:45 +02:00

add 404 page

This commit is contained in:
Lukas Winkler 2020-06-15 21:02:50 +02:00
parent f35af04084
commit d4f9abb8fd
Signed by: lukas
GPG key ID: 54DE4D798D244853
2 changed files with 13 additions and 1 deletions

6
acros/templates/404.html Normal file
View file

@ -0,0 +1,6 @@
{% extends 'base.html' %}
{% block heading %}
<h1 class="acronym">Page not Found</h1>
{% endblock %}
{% block searchInput %}autofocus{% endblock %}

View file

@ -9,10 +9,14 @@ from acros.models import Acronym, Tag
from acros.serializers import AcronymSerializer, AcronymListSerializer, TagSerializer
from acros.utils.assets import get_css
handler404 = 'acros.views.PageNotFoundView'
class IndexView(generic.TemplateView):
template_name = "acros/index.html"
class PageNotFoundView(generic.TemplateView):
template_name = "404.html"
class OverView(generic.ListView):
template_name = "acros/overview.html"
@ -27,12 +31,13 @@ class DetailView(generic.DetailView):
model = Acronym
class EditView(LoginRequiredMixin, generic.UpdateView):
class EditView(LoginRequiredMixin, SuccessMessageMixin, generic.UpdateView):
template_name = 'acros/edit.html'
context_object_name = 'acro'
model = Acronym
# fields = ['name', 'full_name', "description_md", "tags"]
form_class = EditForm
success_message = 'Acronym "%(name)s" was edited successfully'
class AddView(LoginRequiredMixin, SuccessMessageMixin, generic.CreateView):
@ -54,6 +59,7 @@ class TagAcroView(generic.ListView):
template_name = "acros/tagacro.html"
context_object_name = 'acros'
ordering = "name"
allow_empty = False
def get_queryset(self):
return Acronym.objects.filter(tags__slug__exact=self.kwargs['slug'])