Checkboxes in Django 2.0

0

Hello, I recently managed to implement checkboxes for my model through the MultiSelectField library, but rendering them in the template leaves them all in a column exceeding the size of even page and rendering an input text field next to checkboxes . I would like to know how I can resolve this by splitting the options into more columns, or if there is another method to implement the checkboxes in django. Can anyone help?

model.py:

n_dentes = (
    ('18', '18'),
    ('17', '17'),
    ('16', '16'),
    ('15', '15'),
    ('14', '14'),
    ('13', '13'),
    ('12', '12'),
    ('11', '11'),
    ('21', '21'),
)
class pregao(models.Model):
    dente = MultiSelectField(_('Dente '), choices=n_dentes,  default=' ', max_length=100)
    cor = models.CharField(_('Cor '), default=' ', max_length=5)
    material = models.CharField(_('Material '), choices=materiais_choices, max_length=100, default=' ')
    extra = models.TextField(_('Observações '), max_length=500, null=True, blank=True)
    data = models.DateField(default=datetime.date.today)
    preco = models.FloatField(_('Preço '), default='0')
    class Meta:
        verbose_name = 'Pregão'
        verbose_name_plural = 'Pregões'

template.html

{% load bootstrap %}
{% load widget_tweaks %}

{% block main %}

<div class="row b2">
     <div class="col-1"></div>
     <div class="col-8">
            <h3 style="color:royalblue">Insira seu novo pregão: </h3>
            <form method="post" novalidate>
                <img src="../media/site/Quadrantes.jpg" class="img-responsive img-pregao">
                {% csrf_token %}
                {% include 'base-form-pregao.html' with form=form %}
                <button class="btn btn-primary btn-block" type="submit" name="" style="float:right">ENVIAR </button>
            </form>
            <br><br><br><br>
         <a href="{% url 'lista-pregoes' %}"><p><i class="fas fa-chevron-left"></i>  Voltar</p></a>
     </div>
</div>
{% endblock %}

base-form.html

{% load widget_tweaks %}

{% for hidden_field in form.hidden_fields %}
  {{ hidden_field }}
{% endfor %}

{% if form.non_field_errors %}
  <div class="alert alert-danger" role="alert">
    {% for error in form.non_field_errors %}
      {{ error }}
    {% endfor %}
  </div>
{% endif %}
{% for field in form.visible_fields %}
  <div class="form-group">
    <hr>
    {{ field.label_tag }}

    {% if form.is_bound %}
      {% if field.errors %}
        {% render_field field class="form-control is-invalid placeholder=field.label_tag" %}
        {% for error in field.errors %}
          <div class="invalid-feedback">
            {{ error }}
          </div>
        {% endfor %}
      {% else %}
        {% render_field field class="form-control is-valid placeholder=form.text.label" %}
      {% endif %}
    {% else %}
      {% render_field field class="form-control" placeholder=form.text.label %}
    {% endif %}

    {% if field.help_text %}
      <small class="form-text text-muted">{{ field.help_text|safe }}</small>
    {% endif %}
  </div>
{% endfor %}
    
asked by anonymous 24.10.2018 / 19:51

0 answers