django form 이용하여 회원가입이나 로그인 구현할때 질문 입니다.
조회수 399회
html 파일에서 form 반복문 돌려서 입력할 공간 만드려고 할때
<form method="post" action=".">
{% csrf_token %}
{% for field in form %}
<div class="input-group">
<label class="input-label-icon">
<span></span>
<input
type="{{ field.field.widget.input_type }}"
placeholder="{{ field.label }}"
name="{{ field.name }}"
id="{{ field.id_for_label }}">
</label>
{% if field.errors %}
<small class="text-red-400">{{ field.errors }}</small>
{% endif %}
</div>
{% endfor %}
<button type="submit" class="btn-submit w-full">
<span>Register Now!</span>
</button>
</form>
혼자 공부할때 배우던 곳에서는 input 값에 type, placeholder, name, id 값을 다 적어서 사용하던데
이후에 복습할때는
<input type="{{ field.field.widget.input_type }}"
placeholder="{{ field.label }}"/>
이렇게만 사용해봤더니 회원가입이나 로그인이 제대로 안되던데
type, placeholder, name, id 저4가지는 꼭 넣어야 되는건가요?
댓글 입력