def __init__(self, attrs=None):
color_widget = widgets.TextInput(attrs={
'type': 'color',
'class': 'colorfield-preview input-small',
})
input_widget = widgets.TextInput(attrs={
'max_length': 7,
'placeholder': 'hex color',
'class': 'colorfield-hex input-small',
'pattern': '#?([0-9a-fA-F]{6}|[0-9a-fA-F]{3})',
})
opacity_widget = widgets.TextInput(attrs={
'type': 'number',
'placeholder': 'opacity',
'class': 'colorfield-opacity input-mini',
'step': '0.05',
'min': 0,
'max': 1,
})
_widgets = (color_widget, input_widget, opacity_widget)
super().__init__(_widgets, attrs)
评论列表
文章目录