Tweak GPC grid filter, to better handle spaces in user input
i.e. when a user copy/pastes a UPC with leading/trailing space
This commit is contained in:
parent
136d181363
commit
9a61f55f76
|
@ -2,7 +2,7 @@
|
|||
################################################################################
|
||||
#
|
||||
# Rattail -- Retail Software Framework
|
||||
# Copyright © 2010-2019 Lance Edgar
|
||||
# Copyright © 2010-2020 Lance Edgar
|
||||
#
|
||||
# This file is part of Rattail.
|
||||
#
|
||||
|
@ -859,8 +859,13 @@ class AlchemyGPCFilter(AlchemyGridFilter):
|
|||
"""
|
||||
Filter data with an equal ('=') query.
|
||||
"""
|
||||
if value is None or value == '':
|
||||
if value is None:
|
||||
return query
|
||||
|
||||
value = value.strip()
|
||||
if not value:
|
||||
return query
|
||||
|
||||
try:
|
||||
return query.filter(self.column.in_((
|
||||
GPC(value),
|
||||
|
@ -870,9 +875,13 @@ class AlchemyGPCFilter(AlchemyGridFilter):
|
|||
|
||||
def filter_not_equal(self, query, value):
|
||||
"""
|
||||
Filter data with a not eqaul ('!=') query.
|
||||
Filter data with a not equal ('!=') query.
|
||||
"""
|
||||
if value is None or value == '':
|
||||
if value is None:
|
||||
return query
|
||||
|
||||
value = value.strip()
|
||||
if not value:
|
||||
return query
|
||||
|
||||
# When saying something is 'not equal' to something else, we must also
|
||||
|
|
Loading…
Reference in a new issue