반응형
{% extends "base.html" %} {% block contents %}
<div class="row mt-5">
<div class="col-12">
<form method="POST" action=".">
{% csrf_token %} {% for field in form %}
<div class="form-group">
<label for="{{ field.id_for_label }}">{{ field.label }}</label>
{{ field.field.widget.name }} {% ifequal field.name 'contents' %}
<textarea
class="form-control"
name="{{ field.name }}"
placeholder="{{ field.label }}"
></textarea>
{% else %}
<input
type="{{ field.field.widget.input_type }}"
class="form-control"
id="{{ field.id_for_label }}"
placeholder="{{ field.label }}"
name="{{ field.name }}"
/>
{% endifequal %}
</div>
{% if field.errors %}
<span style="color:red">{{ field.errors }}</span>
{% endif %} {% endfor %}
<button type="submit" class="btn btn-primary">글쓰기</button>
<button
type="button"
class="btn btn-primary"
onclick="location.href='/board/list/'"
>
돌아가기
</button>
</form>
</div>
</div>
{% endblock %}
반응형
'Python_WEB > Project-Noticeboard' 카테고리의 다른 글
[Django]Board > Views (0) | 2019.12.08 |
---|---|
[Django]Board > Forms (0) | 2019.12.08 |
[Django]Board > Templates > HTML > Board List (0) | 2019.12.08 |
[Django]Board > Templates > HTML > Board_Detail (0) | 2019.12.08 |
[Django]Board > Templates > HTML > Basic (0) | 2019.12.08 |