allow for skipping certain fields when checking for empty rows

This commit is contained in:
Helmut Merz 2013-10-07 14:39:19 +02:00
parent b82bf879fd
commit 4f54192ae4
2 changed files with 7 additions and 2 deletions

View file

@ -127,7 +127,11 @@ class GridFieldInstance(ListFieldInstance):
continue
if value:
item[fi.name] = value
ignoreInCheckOnEmpty = getattr(self.context, 'ignoreInCheckOnEmpty', [])
for k, v in item.items():
if k not in ignoreInCheckOnEmpty and v != '__no_change__':
return item
return {}
class RecordsFieldInstance(GridFieldInstance):

View file

@ -1,5 +1,5 @@
#
# Copyright (c) 2011 Helmut Merz helmutm@cy55.de
# Copyright (c) 2013 Helmut Merz helmutm@cy55.de
#
# This program is free software; you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by
@ -38,6 +38,7 @@ class Grid(schema.List):
instanceName='grid'))
column_types = []
ignoreInCheckOnEmpty = []
cardinality = None