show computed fields in readonly mode in appadmin
This commit is contained in:
@@ -137,6 +137,8 @@ def populate_generator(table, default=True, compute=False, contents={}):
|
||||
continue
|
||||
elif field.type == 'upload':
|
||||
continue
|
||||
elif field.compute is not None:
|
||||
continue
|
||||
elif default and not field.default in (None, ''):
|
||||
record[fieldname] = field.default
|
||||
elif compute and field.compute:
|
||||
|
||||
+1
-1
Submodule gluon/packages/dal updated: f9f0fdfc9a...35dd4fc6f8
+3
-3
@@ -1244,8 +1244,8 @@ class SQLFORM(FORM):
|
||||
# will only use writable or readable fields, unless forced to ignore
|
||||
if fields is None:
|
||||
fields = [f.name for f in table if
|
||||
(ignore_rw or f.writable or f.readable) and
|
||||
(readonly or not f.compute)]
|
||||
(ignore_rw or f.writable or f.readable) and
|
||||
not (f.compute and not record)]
|
||||
self.fields = fields
|
||||
|
||||
# make sure we have an id
|
||||
@@ -1328,7 +1328,7 @@ class SQLFORM(FORM):
|
||||
label = LABEL(label, label and sep, _for=field_id,
|
||||
_id=field_id + SQLFORM.ID_LABEL_SUFFIX)
|
||||
|
||||
cond = readonly or \
|
||||
cond = readonly or field.compute or \
|
||||
(not ignore_rw and not field.writable and field.readable)
|
||||
|
||||
if cond:
|
||||
|
||||
Reference in New Issue
Block a user