dimanche 28 février 2016

Is there a generic way to avoid double labels on checkboxes with django-boostrap3?

I'm using django-boostrap3 with a for field in form loop. I'm looking for a generic way to have the checkboxes without the double labels:

Double labels

<form action="" method="POST" class="form-horizontal">{% csrf_token %}

    {% for field in form %}
        <div class="form-group{% if field.field.required %} required{% endif %}">
            <div class="col-lg-4 col-md-4 control-label">
                {% bootstrap_label field.label %}
            </div>
            <div class="col-lg-6 col-md-6">
                {% bootstrap_field field show_label=False form_group_class=None %}
            </div>
        </div>
    {% endfor %}

{% buttons %}
    <div class="control col-lg-11">
        <button type="submit" name="form_id_productitem"  class="btn btn-sm btn-success">
            {% trans "Submit" %}
        </button>
    </div>
{% endbuttons %}

This is what I want (specifically for checkboxes), preferably in the aformentioned loop:

enter image description here

I Would like the helptext where the second label is displayed. But it seems I have to let go of django-boostrap3 for this because it's not generic enough, and I like the balance between generic and custom.




Aucun commentaire:

Enregistrer un commentaire