zostera/django-bootstrap4

bootstrap_field field form_check_class doesn't overwrite the default checkbox class

ClintGit opened this issue · 1 comments

Tried the following:
<form method="POST" action="{% url 'myauth:account_signup' %}">
{% csrf_token %}
{% for field in signup_form %}
{% if field.name == 'sign-agree-check' %}
{% bootstrap_field field form_check_class='checkmark' show_label=False %}
{% else %}
{% bootstrap_field field show_label=False field_class='m-0 p-0' form_group_class='m-0 p-0' label_class='m-0 p-0' %}
{% endif %}
{% endfor %}
<button type="submit" class="site-btn">Register Now</button>
</form>

This is the HTML that is rendered:
<div class="form-group">
<div class="form-check">
<input type="checkbox" name="sign-agree-check" id="sign-agree-check" class="form-check-input" required="">
<label class="form-check-label" for="sign-agree-check">
I agree to the terms &amp; conditions
</label>
</div>
</div>

I can confirm this.

Using the template tag like this never changes the rendered class:

{% bootstrap_field form.myfield form_check_class='btn btn-primary' show_help=False %}

always results in the class being form-check

<div class="form-group is-valid">
  <div class="form-check">
    <input ...>
    <label class="form-check-label" ...>.....</label>
  </div>
</div>