From 4a71ab5fb146468dd5a072a854aa2e25b46f7890 Mon Sep 17 00:00:00 2001 From: Lance Edgar Date: Sun, 28 Dec 2014 16:00:52 -0600 Subject: [PATCH] Use boolean search filter for batch column filters of 'FLAG' type. --- tailbone/views/batches/rows.py | 18 +++++++++++------- 1 file changed, 11 insertions(+), 7 deletions(-) diff --git a/tailbone/views/batches/rows.py b/tailbone/views/batches/rows.py index 1d5dece0..32127212 100644 --- a/tailbone/views/batches/rows.py +++ b/tailbone/views/batches/rows.py @@ -1,9 +1,8 @@ -#!/usr/bin/env python -# -*- coding: utf-8 -*- +# -*- coding: utf-8 -*- ################################################################################ # # Rattail -- Retail Software Framework -# Copyright © 2010-2012 Lance Edgar +# Copyright © 2010-2014 Lance Edgar # # This file is part of Rattail. # @@ -21,17 +20,20 @@ # along with Rattail. If not, see . # ################################################################################ - """ Batch Row Views """ -from .. import SearchableAlchemyGridView, CrudView +from __future__ import unicode_literals + from pyramid.httpexceptions import HTTPFound -from ...db import Session +from tailbone.views import SearchableAlchemyGridView, CrudView +from tailbone.forms import GPCFieldRenderer +from tailbone.grids.search import BooleanSearchFilter +from tailbone.db import Session + from rattail.db.model import Batch, LabelProfile -from ...forms import GPCFieldRenderer def field_with_renderer(field, column): @@ -76,6 +78,8 @@ def BatchRowsGrid(request): for column in batch.columns: if column.visible: config['filter_label_%s' % column.name] = column.display_name + if column.data_type == 'FLAG(1)': + config['filter_factory_{0}'.format(column.name)] = BooleanSearchFilter return config def grid(self):