[英]How to add new fields in registration form using django-registration
[英]Django-Registration: How to alter the form (need to add submit button that works!)
因此,我嘗試更改Django注冊中的一種形式:我通過pip安裝的應用程序。
如文檔所述,我要創建一個registration / registration_form.html並使用form
作為上下文:
<html>
<p>This is the registration form</p>
<ul>
{{ form.as_ul}}
</ul>
</html>
所以我有兩個問題:
1)在這種情況下,如何更改表單以使其具有實際可用的提交按鈕?
2)如何更改django注冊模式,以便最終可以在注冊表格中添加更多內容?
是的,我查看了文檔,我在這里問是因為該語言使我感到困惑,並且對我來說似乎有點進步。
謝謝!
您需要添加表單標簽和提交按鈕。 像這樣:
<html>
<p>This is the registration form</p>
<form action="/url/to/register/" method="POST">
{{form.as_ul}}
<input type="submit" value="Register">
</form>
</html>
需要在urls.py中將“ / url / to / register /”指向您的視圖代碼。 像這樣:
from django.conf.urls import url, patterns
from yoursite.registrations import views
urlpatterns = patterns('',
url(r'^url/to/register/', views.register_some_guy),
)
聲明:本站的技術帖子網頁,遵循CC BY-SA 4.0協議,如果您需要轉載,請注明本站網址或者原文地址。任何問題請咨詢:yoyou2525@163.com.