본문 바로가기

Python_WEB/Project-Noticeboard

[Django]Board > Templates > HTML > Login

{% extends "base.html" %} {% block contents %}
<div class="row mt-5">
  <div class="col-12 text-center">
    <h1>로그인</h1>
  </div>
</div>
<div class="row mt-5">
  <div class="col-12">
    {{ error }}
  </div>
</div>
<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>
        <input
          type="{{ field.field.widget.input_type }}"
          class="form-control"
          id="{{ field.id_for_label }}"
          placeholder="{{ field.label }}"
          name="{{ field.name }}"
        />
      </div>
      {% if field.errors %}
      <span style="color:red">{{ field.errors }}</span>
      {% endif %} {% endfor %}
      <!-- <div class="form-group">
        <label for="username">사용자 이름</label>
        <input
          type="text"
          class="form-control"
          placeholder="사용자 이름"
          name="username"
        />
      </div>
      <div class="form-group">
        <label for="password">비밀번호</label>
        <input
          type="password"
          class="form-control"
          id="password"
          placeholder="비밀번호"
          name="password"
        />
      </div> -->
      <button type="submit" class="btn btn-primary">로그인</button>
    </form>
  </div>
</div>
{% endblock %}