2

I work for the implementation of bootstrap 3 encountered a problem in the forms.

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

    {% for field in form %}
        <div class="form-group {% if field.errors %} error{% endif %}{% if field.required %} required{% endif %}">
            <label class="col-sm-2 control-label" for="{{ field.id_for_label }}">{{ field.label_tag }}</label>
                {{ field }}
                    {% for error in field.errors %}
                    <p class="help-block">{{ error }}</p>
                    {% endfor %}
        </div>
    {% endfor %}
</form>

input has no class = "form-control" so the form is not displayed correctly.enter image description here How to fix it?

2 Answers 2

1

Indeed this happens with default Django form widgets. You have the following possibilites in order of complexity:

The last one is kind of cumbersome but effective and you do not very much care if JS is disabled since this affects style and not functionality.

Sign up to request clarification or add additional context in comments.

Comments

1

Look on django-crispy-forms http://django-crispy-forms.readthedocs.org/en/latest/install.html. It is easy way to integration django project with bootstrap 3

Comments

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.