Closed jonaqp closed 4 years ago
from floppyforms import RadioSelect
custom
class CustomClearableRadioSelectOne(RadioSelect): template_name = 'themes/widgets/clearable_radio1.html'
template <ul>{% for group_name, choices in optgroups %}{% for choice in choices %} <li><label for="{{ attrs.id }}_{{ forloop.counter }}"> <input type="radio" id="{{ attrs.id }}_{{ forloop.counter }}" value="{{ choice.0 }}" name="{{ name }}"{% if required %} required{% endif %}{% if choice.0 in value %} checked{% endif %}> {{ choice.1 }}</label></li> {% endfor %}{% endfor %}</ul> forms
<ul>{% for group_name, choices in optgroups %}{% for choice in choices %} <li><label for="{{ attrs.id }}_{{ forloop.counter }}"> <input type="radio" id="{{ attrs.id }}_{{ forloop.counter }}" value="{{ choice.0 }}" name="{{ name }}"{% if required %} required{% endif %}{% if choice.0 in value %} checked{% endif %}> {{ choice.1 }}</label></li> {% endfor %}{% endfor %}</ul>
class UserForm(forms.ModelForm): document_choice = core_constants.TRIBUTE_PERSON_OPTIONS document_type = forms.ChoiceField( label="document type", widget=CustomClearableRadioSelectOne, choices=document_choice, required=True)
html <div class="form-group"> {{ form.document_type.label_tag }} {{ form.document_type }} </div> here the errors. (https://ibb.co/euhfU5)
<div class="form-group"> {{ form.document_type.label_tag }} {{ form.document_type }} </div>
here the errors. (https://ibb.co/euhfU5)
Something that happened? I would like to change to create in this way. Any one a help or is it a bug?
(https://ibb.co/kAG795)
thanks
the renderer error is from using pre-1.8.0. That is fixed now
renderer
from floppyforms import RadioSelect
Something that happened? I would like to change to create in this way. Any one a help or is it a bug?
(https://ibb.co/kAG795)
thanks