mirror of https://github.com/snachodog/mybuddy.git
💄 renders inputs as Bootstrap radio buttons
This commit is contained in:
parent
956125afcc
commit
e86d7cc6f6
|
@ -0,0 +1,8 @@
|
||||||
|
{% with id=widget.attrs.id %}
|
||||||
|
<div{% if id %} id="{{ id }}"{% endif %} class="btn-group btn-group-toggle" data-toggle="buttons">
|
||||||
|
{% for group, options, index in widget.optgroups %}
|
||||||
|
{% for option in options %}
|
||||||
|
{% include option.template_name with widget=option %}
|
||||||
|
{% endfor %}
|
||||||
|
{% endfor %}
|
||||||
|
</div>{% endwith %}
|
|
@ -2,7 +2,8 @@
|
||||||
|
|
||||||
{% if widget.wrap_label %}
|
{% if widget.wrap_label %}
|
||||||
<label{% if widget.attrs.id %}
|
<label{% if widget.attrs.id %}
|
||||||
for="{{ widget.attrs.id }}"{% endif %}>{% endif %}{% include "django/forms/widgets/input.html" %}
|
for="{{ widget.attrs.id }}"{% endif %}
|
||||||
|
class="btn btn-outline-light btn-no-hover">{% endif %}{% include "django/forms/widgets/input.html" %}
|
||||||
{% if widget.wrap_label %}
|
{% if widget.wrap_label %}
|
||||||
{% include "core/child_thumbnail.html" with child=widget %}
|
{% include "core/child_thumbnail.html" with child=widget %}
|
||||||
{{ widget.label }}</label>{% endif %}
|
{{ widget.label }}</label>{% endif %}
|
||||||
|
|
|
@ -85,6 +85,7 @@ class TagsEditor(Widget):
|
||||||
|
|
||||||
class ChildRadioSelect(RadioSelect):
|
class ChildRadioSelect(RadioSelect):
|
||||||
input_type = "radio"
|
input_type = "radio"
|
||||||
|
template_name = "core/child_radio.html"
|
||||||
option_template_name = "core/child_radio_option.html"
|
option_template_name = "core/child_radio_option.html"
|
||||||
|
|
||||||
def create_option(self, name, value, label, selected, index, subindex=None, attrs=None):
|
def create_option(self, name, value, label, selected, index, subindex=None, attrs=None):
|
||||||
|
|
Loading…
Reference in New Issue