Improvements to generic list + use for supplier

This commit is contained in:
2020-03-15 18:38:51 +00:00
parent 3814f5abfc
commit 2bfecb9c0f
4 changed files with 28 additions and 34 deletions

View File

@@ -1,20 +1,33 @@
{% load url_replace from filters %}
{% load orderby from filters %}
{% load paginator from filters %}
<div class="col-sm-12">{% paginator %}</div>
<div class="row justify-content-end">
<a href="{% url create %}" class="btn btn-success">New <span
class="fas fa-plus"></span></a>
</div>
<div class="row justify-content-end">
<form class="form-inline py-3">
{% csrf_token %}
<div class="input-group pull-right">
<input type="search" name="query" placeholder="Search" value="{{ request.GET.query }}"
class="form-control"/>
<span class="input-group-append"><button type="submit" class="btn btn-primary" id="id_search">Search</button></span>
</div>
</form>
</div>
<div class="table-responsive">
<table class="table table-striped">
<thead>
<tr>
<td scope="col">#</td>
<td scope="col">Name<a href="?{% orderby request 'orderBy' 'name' %}"><span class="caret"></span></a></td>
<td scope="col">Email</td>
<td scope="col">Phone</td>
<td scope="col">Notes</td>
<th scope="col">#</th>
<th scope="col">Name<a href="?{% orderby request 'orderBy' 'name' %}"><span class="caret"></span></a></td>
<th scope="col">Email</th>
<th scope="col">Phone</th>
<th scope="col">Notes</th>
{% if union_account %} {#TODO#}
<td scope="col">Union Account</td>
<th scope="col">Union Account</th>
{% endif %}
<td scope="col">Quick Links</td>
<th scope="col">Quick Links</th>
</tr>
</thead>
<tbody>
@@ -45,4 +58,6 @@
</tbody>
</table>
</div>
{% if is_paginated %}
<div class="col-sm-12">{% paginator %}</div>
{% endif %}

View File

@@ -11,18 +11,6 @@
<div class="col-sm-10">
<h3>People</h3>
</div>
<div class="col-sm-2">
<a href="{% url 'person_create' %}" class="btn btn-primary pull-right">New <span
class="fas fa-plus"></span></a>
</div>
<div class="col-sm-3 col-sm-offset-9">
<form class="form form-horizontal col-sm-12">
<div class="form-group">
<input type="search" name="q" placeholder="Search" value="{{ request.GET.q }}"
class="form-control"/>
</div>
</form>
</div>
</div>
{% include 'partials/generic_list.html' with edit="person_update" detail="person_detail" %}
{% include 'partials/generic_list.html' with edit="person_update" detail="person_detail" create="person_create" %}
{% endblock %}

View File

@@ -78,7 +78,7 @@ class PersonList(generic.ListView):
paginate_by = 20
def get_queryset(self):
q = self.request.GET.get('q', "")
q = self.request.GET.get('query', "")
filter = Q(name__icontains=q) | Q(email__icontains=q) | Q(address__icontains=q) | Q(notes__icontains=q) | Q(phone__startswith=q) | Q(phone__endswith=q)
@@ -143,7 +143,7 @@ class OrganisationList(generic.ListView):
paginate_by = 20
def get_queryset(self):
q = self.request.GET.get('q', "")
q = self.request.GET.get('query', "")
filter = Q(name__icontains=q) | Q(email__icontains=q) | Q(address__icontains=q) | Q(notes__icontains=q) | Q(phone__startswith=q) | Q(phone__endswith=q)
@@ -207,7 +207,7 @@ class VenueList(generic.ListView):
paginate_by = 20
def get_queryset(self):
q = self.request.GET.get('q', "")
q = self.request.GET.get('query', "")
filter = Q(name__icontains=q) | Q(email__icontains=q) | Q(address__icontains=q) | Q(notes__icontains=q) | Q(phone__startswith=q) | Q(phone__endswith=q)