ревьюеру

← разместить еще код

Расшаренный код:

            <form method="post" action="{% url 'new_post' %}">
                    {% csrf_token %}

                    {% for field in form %}
                        <div class="form-group row"
                            aria-required="{% if field.field.required %}true{% else %}false{% endif %}">
                            <label for="{{ field.id_for_label }}"
                                class="col-md-4 col-form-label text-md-right">{{ field.label }}{% if field.field.required %}<span
                                    class="required"></span>{% endif %}</label>
                            <div class="col-md-6">

                                {{ field|addclass:"form-control" }}

                                {% if field.help_text %}
                                <small id="{{ field.id_for_label }}-help"
                                    class="form-text text-muted">{{ field.help_text|safe }}</small>
                                {% endif %}
                            </div>
                        </div>
                    {% endfor %}

                    <div class="col-md-6 offset-md-4">
                        <button type="submit" class="btn btn-primary">
                            Создать запись
                        </button>
                    </div>
                </form>