From 2bfecb9c0fa3538b716a22d3e5cc155b4ce62774 Mon Sep 17 00:00:00 2001 From: FreneticScribbler Date: Sun, 15 Mar 2020 18:38:51 +0000 Subject: [PATCH] Improvements to generic list + use for supplier --- RIGS/templates/partials/generic_list.html | 31 +++++++++++++++++------ RIGS/templates/person_list.html | 14 +--------- RIGS/views.py | 6 ++--- assets/templates/supplier_list.html | 11 +------- 4 files changed, 28 insertions(+), 34 deletions(-) diff --git a/RIGS/templates/partials/generic_list.html b/RIGS/templates/partials/generic_list.html index 002bb027..8d75db38 100644 --- a/RIGS/templates/partials/generic_list.html +++ b/RIGS/templates/partials/generic_list.html @@ -1,20 +1,33 @@ {% load url_replace from filters %} {% load orderby from filters %} {% load paginator from filters %} -
{% paginator %}
+
+ New +
+
+
+ {% csrf_token %} +
+ + +
+
+
- - - - - + + + + {% if union_account %} {#TODO#} - + {% endif %} - + @@ -45,4 +58,6 @@
#NameEmailPhoneNotes#Name + EmailPhoneNotesUnion AccountUnion AccountQuick LinksQuick Links
+{% if is_paginated %}
{% paginator %}
+{% endif %} diff --git a/RIGS/templates/person_list.html b/RIGS/templates/person_list.html index 70cbc605..296dfb47 100644 --- a/RIGS/templates/person_list.html +++ b/RIGS/templates/person_list.html @@ -11,18 +11,6 @@

People

-
- New -
-
-
-
- -
-
-
- {% 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 %} diff --git a/RIGS/views.py b/RIGS/views.py index 85208e70..3b93dcd9 100644 --- a/RIGS/views.py +++ b/RIGS/views.py @@ -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) diff --git a/assets/templates/supplier_list.html b/assets/templates/supplier_list.html index 6ba6ba92..e7826c4f 100644 --- a/assets/templates/supplier_list.html +++ b/assets/templates/supplier_list.html @@ -9,15 +9,6 @@

Supplier List

-
- {% csrf_token %} -
- {% render_field form.query|add_class:'form-control' placeholder='Search by Name' style="width: 250px"%} - - -
-
- -{% include 'partials/generic_list.html' with edit="supplier_update" detail="supplier_detail" %} +{% include 'partials/generic_list.html' with edit="supplier_update" detail="supplier_detail" create="supplier_create" %} {% endblock %}