django admin background display H5 color tab

Generally, django background is used, especially when there are colored fields, to avoid manually entering a large number of colors, you can use the h5 color tab, so that users can directly select the color they want through the tab. At this time, it can be customized through the background admin form.

from django.forms.widgets import TextInput  
class RelationTypeForm(ModelForm):
    class Meta:
        model = RelationType
        fields = '__all__'
        widgets = {
            'relation_color': TextInput(attrs={'type': 'color'}), #type:color is a fixed value
        }

 

Guess you like

Origin http://43.154.161.224:23101/article/api/json?id=324733830&siteId=291194637