我是Django的新手,我想在基本html中包含我的登錄表單。在base.html中包含Django登錄表單
我有以下:
「註冊/ login.html的」
{% if form.has_errors %}
<p>Your username and password didn't match.
Please try again.</p>
{% endif %}
<form method="post" action=".">
{% csrf_token %}
<p><label>Username:</label>
{{ form.username }}</p>
<p><label>Password:</label>
{{ form.password }}</p>
<input type="submit" value="login" />
<input type="hidden" name="next" value="/" />
</form>
urls.py
url(r'^login/$', 'django.contrib.auth.views.login'),
而我包括在base.html文件執行以下操作:
{% include "registration/login.html" %}
它呈現每除用於用戶名和密碼的文本框外。我想我錯過了一些東西。
它呈現提交按鈕嗎? – bluszcz 2013-02-26 10:10:51
是的,呈現登錄按鈕。 – glarkou 2013-02-26 10:14:37
ewen是正確的我只是刪除了我的答案 – catherine 2013-02-26 10:21:37