Use boolean search filter for batch column filters of 'FLAG' type.

This commit is contained in:
Lance Edgar 2014-12-28 16:00:52 -06:00
parent 9e6b02bcc8
commit 4a71ab5fb1

View file

@ -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 <http://www.gnu.org/licenses/>.
#
################################################################################
"""
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):