provide method for automatic conversion from KeyTable to Records field
This commit is contained in:
parent
abfd75a782
commit
e5f1be9f91
1 changed files with 6 additions and 0 deletions
|
@ -175,6 +175,12 @@ class RecordsFieldInstance(GridFieldInstance):
|
||||||
def getRenderer(self, name):
|
def getRenderer(self, name):
|
||||||
return grid_macros.macros.get(name)
|
return grid_macros.macros.get(name)
|
||||||
|
|
||||||
|
def fromKeyTable(self, value):
|
||||||
|
fis = self.columnFieldInstances
|
||||||
|
return [dict([(fis[0].name, k)] +
|
||||||
|
[(fi.name, v[i]) for i, v in enumerate(fis[1:])])
|
||||||
|
for k, v in value.items()]
|
||||||
|
|
||||||
def marshall(self, value):
|
def marshall(self, value):
|
||||||
result = []
|
result = []
|
||||||
value = value or []
|
value = value or []
|
||||||
|
|
Loading…
Add table
Reference in a new issue