标签:label cycle inpu temp options idg src closed port
from django.forms.widgets import RadioSelect class ColorRadioSelect(RadioSelect): # input_type = ‘radio‘ # template_name = ‘django/forms/widgets/radio.html‘ # option_template_name = ‘django/forms/widgets/radio_option.html‘ template_name = ‘widgets/radio.html‘ option_template_name = ‘widgets/radio_option.html‘
{% with id=widget.attrs.id %} {# 定义id变量 id=widget.attrs.id#} <div{% if id %} id="{{ id }}"{% endif %}{% if widget.attrs.class %} class="{{ widget.attrs.class }}"{% endif %}> {% for group, options, index in widget.optgroups %} {% for option in options %} <label {% if option.attrs.id %}for=" {{ option.attrs.id }}"{% endif %}> {% include option.template_name with widget=option %} </label> {% endfor %} {% endfor %} </div> {% endwith %}
{% include "django/forms/widgets/input.html" %} <span class="cycle" style="background-color:{{ option.label }}"></span>
标签:label cycle inpu temp options idg src closed port
原文地址:https://www.cnblogs.com/hude/p/12826055.html