From d295cf04afb3ab37564cd033bb06a01d71b24a65 Mon Sep 17 00:00:00 2001 From: Lance Edgar Date: Sun, 19 Sep 2021 18:36:25 -0500 Subject: [PATCH 0001/1296] Allow setting the "exclusive" sequence of grid filters i.e. let caller specify that any not included, should be omitted --- tailbone/grids/core.py | 21 +++++++++++++++++---- 1 file changed, 17 insertions(+), 4 deletions(-) diff --git a/tailbone/grids/core.py b/tailbone/grids/core.py index d52e0fa8..a4d3cc92 100644 --- a/tailbone/grids/core.py +++ b/tailbone/grids/core.py @@ -28,6 +28,7 @@ from __future__ import unicode_literals, absolute_import import datetime import warnings +import logging import six from six.moves import urllib @@ -49,6 +50,9 @@ from tailbone.db import Session from tailbone.util import raw_datetime +log = logging.getLogger(__name__) + + class FieldList(list): """ Convenience wrapper for a field list. @@ -1047,7 +1051,7 @@ class Grid(object): return render(template, context) - def set_filters_sequence(self, filters): + def set_filters_sequence(self, filters, only=False): """ Explicitly set the sequence for grid filters, using the sequence provided. If the grid currently has more filters than are mentioned in @@ -1055,12 +1059,21 @@ class Grid(object): tacked on at the end. :param filters: Sequence of filter keys, i.e. field names. + + :param only: If true, then *only* those filters specified will + be kept, and all others discarded. If false then any + filters not specified will still be tacked onto the end, in + alphabetical order. """ new_filters = gridfilters.GridFilterSet() for field in filters: - new_filters[field] = self.filters.pop(field) - for field in self.filters: - new_filters[field] = self.filters[field] + if field in self.filters: + new_filters[field] = self.filters.pop(field) + else: + log.warning("field '%s' is not in current filter set", field) + if not only: + for field in sorted(self.filters): + new_filters[field] = self.filters[field] self.filters = new_filters def get_filters_sequence(self): From 8af247a7f633adba0aa117e1299c9d7e2a8905a5 Mon Sep 17 00:00:00 2001 From: Lance Edgar Date: Sun, 19 Sep 2021 19:08:53 -0500 Subject: [PATCH 0002/1296] Update changelog --- CHANGES.rst | 6 ++++++ tailbone/_version.py | 2 +- 2 files changed, 7 insertions(+), 1 deletion(-) diff --git a/CHANGES.rst b/CHANGES.rst index 95773484..0cf4a503 100644 --- a/CHANGES.rst +++ b/CHANGES.rst @@ -2,6 +2,12 @@ CHANGELOG ========= +0.8.145 (2021-09-19) +-------------------- + +* Allow setting the "exclusive" sequence of grid filters. + + 0.8.144 (2021-09-16) -------------------- diff --git a/tailbone/_version.py b/tailbone/_version.py index 49ad6884..a837239c 100644 --- a/tailbone/_version.py +++ b/tailbone/_version.py @@ -1,3 +1,3 @@ # -*- coding: utf-8; -*- -__version__ = '0.8.144' +__version__ = '0.8.145' From d0a7a241b449b3bbcdaa9016e1f4ce43370d6646 Mon Sep 17 00:00:00 2001 From: Lance Edgar Date: Tue, 21 Sep 2021 13:49:51 -0500 Subject: [PATCH 0003/1296] Misc. improvements for customer order views --- tailbone/templates/custorders/create.mako | 34 +++++++--- tailbone/views/custorders/batch.py | 1 + tailbone/views/custorders/items.py | 52 +++++++++++++-- tailbone/views/custorders/orders.py | 79 +++++++++++++++++++++-- 4 files changed, 143 insertions(+), 23 deletions(-) diff --git a/tailbone/templates/custorders/create.mako b/tailbone/templates/custorders/create.mako index c035b3c0..f0e5d5b3 100644 --- a/tailbone/templates/custorders/create.mako +++ b/tailbone/templates/custorders/create.mako @@ -30,9 +30,10 @@
- Submit this Order + {{ submitOrderButtonText }}
- - Add Item - +
+ + Add Item + +
@@ -288,8 +291,8 @@
- +