--- a/src/pyams_form/group.py Tue Jul 17 18:02:48 2018 +0200
+++ b/src/pyams_form/group.py Wed Jul 18 15:48:37 2018 +0200
@@ -85,9 +85,12 @@
def visible(self):
if self.checkbox_switch:
widget = self.checkbox_widget
- context = widget.context
- name = widget.field.getName()
- value = getattr(widget.field.interface(context), name, None)
+ if self.form.ignoreContext:
+ value = widget.field.default
+ else:
+ context = widget.context
+ name = widget.field.getName()
+ value = getattr(widget.field.interface(context), name, None)
return bool(value)
else:
if self.display_mode == 'never':
@@ -98,9 +101,12 @@
for widget in self.widgets:
if not widget.ignoreContext:
field = widget.field
- context = widget.context
- name = field.getName()
- value = getattr(field.interface(context), name, None)
+ if self.form.ignoreContext:
+ value = field.default
+ else:
+ context = widget.context
+ name = field.getName()
+ value = getattr(field.interface(context), name, None)
if value and (value != field.default):
if II18nField.providedBy(field):
for i18n_value in value.values():