Add info about customizing template

From issue #57.
This commit is contained in:
blag 2017-02-21 15:39:55 -07:00 committed by GitHub
parent 81fc7abc8e
commit 0b475a41f8

View file

@ -80,6 +80,21 @@ Only you need it, if you want the translation of django-multiselectfield
)
Customizing templates
---------------------
It is possible to customize the HTML of this widget in your form template. To do so, you will need to loop through ``form.{field}.field.choices``. Here is an example that displays the field label underneath/after the checkbox for a ``MultiSelectField`` called ``providers``:
.. code-block:: HTML+Django
{% for value, text in form.providers.field.choices %}
<div class="ui slider checkbox">
<input id="id_providers_{{ forloop.counter0 }}" name="{{ form.providers.name }}" type="checkbox" value="{{ value }}">
<label>{{ text }}</label>
</div>
{% endfor %}
Django REST Framework
---------------------