make sure query criteria is a number for a 'number' field
This commit is contained in:
parent
67b969a481
commit
b63b3b3b16
2 changed files with 5 additions and 2 deletions
|
@ -162,6 +162,9 @@ class LeafQueryCriteria(BaseQueryCriteria, Element):
|
||||||
if comparisonValue in (None, '',):
|
if comparisonValue in (None, '',):
|
||||||
return True
|
return True
|
||||||
value = self.field.getSelectValue(row)
|
value = self.field.getSelectValue(row)
|
||||||
|
if (self.field.fieldType == 'number' and
|
||||||
|
isinstance(comparisonValue, basestring)):
|
||||||
|
comparisonValue = int(comparisonValue)
|
||||||
op = operators.get(self.operator)
|
op = operators.get(self.operator)
|
||||||
if op is None:
|
if op is None:
|
||||||
op = getattr(standard_operators, self.operator, None)
|
op = getattr(standard_operators, self.operator, None)
|
||||||
|
|
|
@ -72,8 +72,8 @@ class Field(Component):
|
||||||
return row.getRawValue(self.name)
|
return row.getRawValue(self.name)
|
||||||
|
|
||||||
def getSelectValue(self, row):
|
def getSelectValue(self, row):
|
||||||
return getattr(row, self.name, None)
|
return getattr(row, self.name, None) # backwards compatibility
|
||||||
#return self.getRawValue(row) # better let row control selection...
|
# return self.getRawValue(row) # overwrite with this in subclass
|
||||||
|
|
||||||
def getValue(self, row):
|
def getValue(self, row):
|
||||||
value = self.getRawValue(row)
|
value = self.getRawValue(row)
|
||||||
|
|
Loading…
Add table
Reference in a new issue