Few more tweaks to UI
parent
efe12b5b21
commit
a4d71858bf
|
@ -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;
|
||||
}
|
||||
|
|
@ -1,5 +0,0 @@
|
|||
.sidebar-nav {
|
||||
margin-top: 20px;
|
||||
padding: 0;
|
||||
list-style: none;
|
||||
}
|
|
@ -1,6 +1,9 @@
|
|||
<!DOCTYPE html>
|
||||
{% load static %}
|
||||
|
||||
<html lang="en">
|
||||
<head>
|
||||
<link rel="shortcut icon" type="image/png" href="{% static 'GeoffreyApp/img/icon.png' %}"/>
|
||||
<meta charset="UTF-8">
|
||||
{% block title %}<title>GeoffreyApp</title>{% endblock %}
|
||||
<meta name="viewport" content="width=device-width, initial-scale=1">
|
||||
|
@ -8,20 +11,28 @@
|
|||
integrity="sha384-MCw98/SFnGE8fJT3GXwEOngsV7Zt27NXFoaoApmYm81iuXoPkFOJwJ8ERdknLPMO" crossorigin="anonymous">
|
||||
<!-- Add additional CSS in static file -->
|
||||
{% load static %}
|
||||
<link rel="stylesheet" href="{% static 'css/styles.css' %}">
|
||||
<link rel="stylesheet" href="{% static 'GeoffreyApp/css/style.css' %}">
|
||||
</head>
|
||||
<body>
|
||||
<body>
|
||||
<nav class="navbar">
|
||||
<div class="container-fluid">
|
||||
<div class="navbar-header">
|
||||
<a<img src="{% static 'GeoffreyApp/img/icon.png' %}" alt="Sed" height="100" width="100"/>
|
||||
<a class="navbar-brand" style="color:inherit;cursor:default;">Geoffrey</a>
|
||||
</div>
|
||||
</div>
|
||||
</nav>
|
||||
<div class="container-fluid">
|
||||
<div class="row">
|
||||
<div class="col-sm-2">
|
||||
{% block sidebar %}
|
||||
<ul class="sidebar-nav">
|
||||
<li><a href="{% url 'GeoffreyHome' %}">Home</a></li>
|
||||
<li><a href="{% url 'GeoffreyPlayers' %}">Players</a></li>
|
||||
<li><a href="{% url 'GeoffreyBases' %}">Bases</a></li>
|
||||
<li><a href="{% url 'GeoffreyShops' %}">Shops</a></li>
|
||||
<li><a href="{% url 'GeoffreyItems' %}">Items</a></li>
|
||||
<li class="sidebar-option"><a class="sidebar-a" href="{% url 'GeoffreyHome' %}">Home</a></li>
|
||||
<li class="sidebar-option"><a class="sidebar-a" href="{% url 'GeoffreyPlayers' %}">Players</a></li>
|
||||
<li class="sidebar-option"><a class="sidebar-a" href="{% url 'GeoffreyBases' %}">Bases</a></li>
|
||||
<li class="sidebar-option"><a class="sidebar-a" href="{% url 'GeoffreyShops' %}">Shops</a></li>
|
||||
<li class="sidebar-option"><a class="sidebar-a" href="{% url 'GeoffreyItems' %}">Items</a></li>
|
||||
|
||||
</ul>
|
||||
{% endblock %}
|
||||
|
|
|
@ -2,6 +2,13 @@
|
|||
|
||||
{% block content %}
|
||||
<h1>Shops</h1>
|
||||
|
||||
<form id="searchform" action="{% url 'GeoffreyShops' %}" method="get" accept-charset="utf-8">
|
||||
<button class="searchbutton" type="submit">
|
||||
<i class="fa fa-search">Go</i>
|
||||
</button>
|
||||
<input class="searchfield" id="searchbox" name="q" type="text" placeholder="Search">
|
||||
</form>
|
||||
{% if shop_list %}
|
||||
<ul>
|
||||
{% for shop in shop_list %}
|
||||
|
|
11
views.py
11
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
|
||||
|
||||
|
|
Loading…
Reference in New Issue