diff --git a/web_dev/sas_web/datenbank/templates/datenbank/index.html b/web_dev/sas_web/datenbank/templates/datenbank/index.html
index f4eb6c1..1695209 100644
--- a/web_dev/sas_web/datenbank/templates/datenbank/index.html
+++ b/web_dev/sas_web/datenbank/templates/datenbank/index.html
@@ -14,6 +14,15 @@
+ {% if rows|length == 0 %}
+
+ |
+
+ Keine Einträge für den Suchbegriff "{{ query }}" gefunden.
+
+ |
+
+ {% endif %}
{% for row in rows %}
{% for entry in row %}
diff --git a/web_dev/sas_web/datenbank/views.py b/web_dev/sas_web/datenbank/views.py
index ef5782e..64b34e5 100644
--- a/web_dev/sas_web/datenbank/views.py
+++ b/web_dev/sas_web/datenbank/views.py
@@ -6,9 +6,15 @@ from .models import Entry
# Create your views here.
def index(request):
- rows = group(Entry.objects.all(), 3)
- print("rows", rows)
- return render(request, "datenbank/index.html", {'rows': rows})
+ query = ""
+ if request.method == 'POST':
+ query = request.POST['query']
+ objects = Entry.objects.filter(title__icontains=query)
+ else:
+ objects = Entry.objects.all()
+ rows = group(objects, 3)
+ return render(request, "datenbank/index.html", {'rows': rows,
+ 'query': query})
def group(l, n):
diff --git a/web_dev/sas_web/static/public/css/header.css b/web_dev/sas_web/static/public/css/header.css
index 9c536e5..d29d6eb 100644
--- a/web_dev/sas_web/static/public/css/header.css
+++ b/web_dev/sas_web/static/public/css/header.css
@@ -23,6 +23,16 @@ html {
vertical-align: middle;
padding-left: 0px;
}
+#submit_search {
+ border: none;
+ background-color: transparent;
+ color: transparent;
+ background-image: url('../images/search_icon.png');
+ background-size: 100%;
+ background-position: center;
+ height: 64px;
+ background-repeat: no-repeat;
+}
table{
border-collapse: collapse;
border: none;
diff --git a/web_dev/sas_web/templates/public/header.html b/web_dev/sas_web/templates/public/header.html
index 611af0c..b5fb3b2 100644
--- a/web_dev/sas_web/templates/public/header.html
+++ b/web_dev/sas_web/templates/public/header.html
@@ -3,31 +3,34 @@