[gen] Added field dict, similar to List but that stores dicts in the database, with a set of keys given in method field.keys.
This commit is contained in:
parent
424c0521de
commit
7e7d0933f5
7 changed files with 117 additions and 14 deletions
|
@ -29,6 +29,7 @@ from appy.fields.float import Float
|
|||
from appy.fields.info import Info
|
||||
from appy.fields.integer import Integer
|
||||
from appy.fields.list import List
|
||||
from appy.fields.dict import Dict
|
||||
from appy.fields.pod import Pod
|
||||
from appy.fields.ref import Ref, autoref
|
||||
from appy.fields.string import String, Selection
|
||||
|
|
|
@ -319,6 +319,7 @@ class FieldDescriptor:
|
|||
self.i18n('%s_descr' % label, ' ')
|
||||
if field.hasHelp:
|
||||
self.i18n('%s_help' % label, ' ')
|
||||
walkDict = walkList # Same i18n labels for a dict
|
||||
|
||||
def walkCalendar(self):
|
||||
# Add i18n-specific messages
|
||||
|
|
|
@ -256,12 +256,12 @@ class BaseMixin:
|
|||
return dbFolder, path
|
||||
|
||||
def view(self):
|
||||
'''Returns the view PX.'''
|
||||
'''Returns the view PX'''
|
||||
obj = self.appy()
|
||||
return obj.pxView({'obj': obj, 'tool': obj.tool})
|
||||
|
||||
def edit(self):
|
||||
'''Returns the edit PX.'''
|
||||
'''Returns the edit PX'''
|
||||
obj = self.appy()
|
||||
return obj.pxEdit({'obj': obj, 'tool': obj.tool})
|
||||
|
||||
|
@ -347,8 +347,8 @@ class BaseMixin:
|
|||
setattr(errors, field.name, message)
|
||||
else:
|
||||
setattr(values, field.name, field.getStorableValue(self, value))
|
||||
# Validate sub-fields within Lists
|
||||
if field.type != 'List': continue
|
||||
# Validate sub-fields within Lists/Dicts
|
||||
if field.type not in ('List', 'Dict'): continue
|
||||
i = -1
|
||||
for row in value:
|
||||
i += 1
|
||||
|
@ -710,7 +710,7 @@ class BaseMixin:
|
|||
field = self.getAppyType(name)
|
||||
if field.type == 'Pod': return
|
||||
if '*' not in name: return field.getValue(self)
|
||||
# The field is an inner field from a List.
|
||||
# The field is an inner field from a List/Dict
|
||||
listName, name, i = name.split('*')
|
||||
listType = self.getAppyType(listName)
|
||||
return listType.getInnerValue(self, outerValue, name, int(i))
|
||||
|
|
|
@ -124,7 +124,7 @@ td.search { padding-top: 8px }
|
|||
.compact th, .compact td { padding: 0px 3px 0px 3px }
|
||||
.grid th { font-style: italic; font-weight: normal;
|
||||
border-bottom: 5px solid #fdfdfd; padding: 3px 5px 0 5px }
|
||||
.grid td { padding: 3px 3px 0 3px }
|
||||
.grid td { padding: 0 3px }
|
||||
.timeline { font-size: 85%; color: #555555 }
|
||||
.timeline td { text-align: center; padding: 1px }
|
||||
.timeline th { padding: 1px }
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue