From ca066e7c164af6e19a1b33fc4df7fcfeb5b933c3 Mon Sep 17 00:00:00 2001 From: PlexSheep Date: Tue, 30 May 2023 15:23:04 +0200 Subject: [PATCH] search form works --- gawa/blog/urls.py | 2 +- gawa/start/forms.py | 16 ++++++ gawa/start/templates/errors/bad_request.html | 1 + gawa/start/templates/start/base.html | 54 +++++++++---------- gawa/start/templates/start/index.html | 34 ++++++++++-- gawa/start/templates/start/legalinfo.html | 36 +++++++++++++ .../templates/start/mainsearch_snippet.html | 0 gawa/start/templates/start/search.html | 36 +++++++++++++ gawa/start/urls.py | 4 +- gawa/start/views.py | 46 ++++++++++++++-- 10 files changed, 191 insertions(+), 38 deletions(-) create mode 100644 gawa/start/forms.py create mode 100644 gawa/start/templates/errors/bad_request.html create mode 100644 gawa/start/templates/start/legalinfo.html create mode 100644 gawa/start/templates/start/mainsearch_snippet.html create mode 100644 gawa/start/templates/start/search.html diff --git a/gawa/blog/urls.py b/gawa/blog/urls.py index 1249c1c..154fb7d 100644 --- a/gawa/blog/urls.py +++ b/gawa/blog/urls.py @@ -3,5 +3,5 @@ from django.urls import path from . import views urlpatterns = [ - path("", views.IndexView.as_view(), name="index"), + path("", views.IndexView.as_view(), name="BlogIndex"), ] diff --git a/gawa/start/forms.py b/gawa/start/forms.py new file mode 100644 index 0000000..ae05552 --- /dev/null +++ b/gawa/start/forms.py @@ -0,0 +1,16 @@ +from django import forms +from django.utils.translation import gettext as _ + +class MainSearchForm(forms.Form): + search = forms.CharField( + max_length=100, + label='' + ) + search.widget = forms.TextInput( + attrs={ + 'class': "form-control me-2", + 'type': "search", + 'aria-label': "Search", + 'placeholder': _("Search") + } + ) diff --git a/gawa/start/templates/errors/bad_request.html b/gawa/start/templates/errors/bad_request.html new file mode 100644 index 0000000..fe8ccc5 --- /dev/null +++ b/gawa/start/templates/errors/bad_request.html @@ -0,0 +1 @@ +400 you fucked up diff --git a/gawa/start/templates/start/base.html b/gawa/start/templates/start/base.html index 8f11acb..30cdf8c 100644 --- a/gawa/start/templates/start/base.html +++ b/gawa/start/templates/start/base.html @@ -11,7 +11,7 @@