def __init__(self, field, value_field, form, request): super(MultiGenericFieldWidget, self).__init__(field, form, request) self.allowAdding = field.allowAdding self.allowRemove = field.allowRemove self.valueField = value_field self.valueWidgets = Widgets() self.haveValues = False
def update(self): super(ObjectFieldWidget, self).update() value = self.component.dataManager(self.inputValue()) form = cloneFormData(self.form, value, self.identifier) self.objectWidgets = Widgets(form=form, request=self.request) self.objectWidgets.extend(self.component.objectFields) self.objectWidgets.update()
def update(self): super(MultiGenericFieldWidget, self).update() self.valueWidgets.update() self.jsonAddIdentifier = None self.jsonAddTemplate = None self.includeEmptyMessage = self.allowRemove if self.allowAdding: self.jsonAddIdentifier = 'id' + md5hash(self.identifier) widgets = Widgets() widgets.append(self.createValueWidget( '{' + self.jsonAddIdentifier + '}', None)) widgets.update() self.jsonAddTemplate = list(widgets)[0]
def jsonTemplateWidget(self): widgets = Widgets() widgets.append(self.createValueWidget('{identifier}', None)) widgets.update() return list(widgets)[0]