From a4d71858bf16b80fa23e6aa09f4ffd58a8e7023d Mon Sep 17 00:00:00 2001 From: Joey Hines Date: Sat, 15 Dec 2018 15:12:17 -0600 Subject: [PATCH] Few more tweaks to UI --- static/GeoffreyApp/css/style.css | 25 +++++++++++++++++++++++++ static/css/style.css | 5 ----- templates/GeoffreyApp/base.html | 23 +++++++++++++++++------ templates/GeoffreyApp/shop_list.html | 7 +++++++ views.py | 11 +++++++++++ 5 files changed, 60 insertions(+), 11 deletions(-) create mode 100644 static/GeoffreyApp/css/style.css delete mode 100644 static/css/style.css diff --git a/static/GeoffreyApp/css/style.css b/static/GeoffreyApp/css/style.css new file mode 100644 index 0000000..cf54664 --- /dev/null +++ b/static/GeoffreyApp/css/style.css @@ -0,0 +1,25 @@ +.sidebar-nav { + list-style-type: none; + margin: 0; + padding: 0; + width: 200px; + background-color: #f1f1f1; +} + +.sidebar-option{ + float: left; +} + +.sidebar-option .sidebar-a { + display: block; + color: #000; + padding: 8px 16px; + text-decoration: none; +} + +/* Change the link color on hover */ +.sidebar-option .sidebar-a:hover { + background-color: #555; + color: white; +} + diff --git a/static/css/style.css b/static/css/style.css deleted file mode 100644 index d7009ee..0000000 --- a/static/css/style.css +++ /dev/null @@ -1,5 +0,0 @@ -.sidebar-nav { - margin-top: 20px; - padding: 0; - list-style: none; -} \ No newline at end of file diff --git a/templates/GeoffreyApp/base.html b/templates/GeoffreyApp/base.html index 21357ef..97f3248 100644 --- a/templates/GeoffreyApp/base.html +++ b/templates/GeoffreyApp/base.html @@ -1,6 +1,9 @@ +{% load static %} + + {% block title %}GeoffreyApp{% endblock %} @@ -8,20 +11,28 @@ integrity="sha384-MCw98/SFnGE8fJT3GXwEOngsV7Zt27NXFoaoApmYm81iuXoPkFOJwJ8ERdknLPMO" crossorigin="anonymous"> {% load static %} - + +
{% block sidebar %} {% endblock %} diff --git a/templates/GeoffreyApp/shop_list.html b/templates/GeoffreyApp/shop_list.html index 451a8c3..38a8eb7 100644 --- a/templates/GeoffreyApp/shop_list.html +++ b/templates/GeoffreyApp/shop_list.html @@ -2,6 +2,13 @@ {% block content %}

Shops

+ +
+ + +
{% if shop_list %}
    {% for shop in shop_list %} diff --git a/views.py b/views.py index e236c6a..5537359 100644 --- a/views.py +++ b/views.py @@ -2,6 +2,7 @@ from django.shortcuts import render from django.views.generic import View from GeoffreyApp.models import * from django.views import generic +from django.db.models import Q # Create your views here. @@ -31,6 +32,16 @@ class PlayerList(generic.ListView): class ShopList(generic.ListView): model = Shop + def get_queryset(self): + qs = Shop.objects.all() + + search = self.request.GET.get('q') + if search: + qs = qs.filter(Q(name__icontains=search) | Q(owner__name__icontains=search)) + + return qs + + class BaseList(generic.ListView): model = Base