add data-supports-check-condition attribute
This commit is contained in:
parent
be1805b6e9
commit
b8a1233ba3
|
@ -876,6 +876,7 @@ class WidgetField(Field):
|
|||
prefill = {}
|
||||
|
||||
widget_class = None
|
||||
widget_supports_check_condition = True
|
||||
|
||||
def add_to_form(self, form, value=None):
|
||||
kwargs = {'required': self.required, 'render_br': False}
|
||||
|
@ -892,7 +893,7 @@ class WidgetField(Field):
|
|||
form.add(self.widget_class, 'f%s' % self.id, title=self.label, hint=hint, **kwargs)
|
||||
widget = form.get_widget('f%s' % self.id)
|
||||
widget.field = self
|
||||
widget.supports_check_condition = True
|
||||
widget.supports_check_condition = self.widget_supports_check_condition
|
||||
if self.extra_css_class:
|
||||
if hasattr(widget, 'extra_css_class') and widget.extra_css_class:
|
||||
widget.extra_css_class = '%s %s' % (widget.extra_css_class, self.extra_css_class)
|
||||
|
@ -1642,6 +1643,7 @@ class FileField(WidgetField):
|
|||
storage = 'default'
|
||||
|
||||
widget_class = FileWithPreviewWidget
|
||||
widget_supports_check_condition = True
|
||||
extra_attributes = [
|
||||
'file_type',
|
||||
'max_file_size',
|
||||
|
@ -3145,6 +3147,7 @@ class TableField(WidgetField):
|
|||
columns = None
|
||||
|
||||
widget_class = TableWidget
|
||||
widget_supports_check_condition = True
|
||||
|
||||
def __init__(self, **kwargs):
|
||||
self.rows = []
|
||||
|
@ -3366,6 +3369,7 @@ class TableRowsField(WidgetField):
|
|||
columns = None
|
||||
|
||||
widget_class = TableListRowsWidget
|
||||
widget_supports_check_condition = True
|
||||
|
||||
def __init__(self, **kwargs):
|
||||
self.columns = []
|
||||
|
@ -3627,6 +3631,7 @@ class RankedItemsField(WidgetField):
|
|||
items = []
|
||||
randomize_items = False
|
||||
widget_class = RankedItemsWidget
|
||||
widget_supports_check_condition = True
|
||||
anonymise = False
|
||||
|
||||
def perform_more_widget_changes(self, form, kwargs, edit=True):
|
||||
|
|
|
@ -6,7 +6,10 @@
|
|||
{% block widget-attrs %}
|
||||
{% if widget.is_hidden %}style="display: none"{% endif %}
|
||||
{% if widget.field %}data-field-id="{{ widget.field.id }}"{% endif %}
|
||||
{% if not widget.readonly and widget.field.validation.type %}data-validation-type="{{ widget.field.validation.type }}"{% endif %}
|
||||
{% if not widget.readonly %}
|
||||
{% if widget.field.validation.type %}data-validation-type="{{ widget.field.validation.type }}"{% endif %}
|
||||
{% if widget.supports_check_condition %}data-supports-check-condition="true"{% endif %}
|
||||
{% endif %}
|
||||
data-widget-name="{{ widget.name }}"
|
||||
{% if widget.div_id %}id="{{widget.div_id}}" data-valuecontainerid="form_{{widget.name}}"{% endif %}
|
||||
{% if widget.a11y_role %}role="{{ a11y_role }}"{% endif %}
|
||||
|
|
Loading…
Reference in New Issue