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})',
})
_widgets = (color_widget, input_widget)
super().__init__(_widgets, attrs)
评论列表
文章目录