如何在django注册通用视图上添加更多选项?

时间:2015-02-16 07:18:06

标签: python django python-3.x django-templates django-views

我知道Django有基于类的通用视图,这使我们能够(例如注册)注册用户,但它有一点选项,我想为它添加更多字段,我该怎么做? 感谢;

在views.py

from django.views.generic import CreateView
from django.contrib.auth.forms import UserCreationForm
from django.core.urlresolvers import reverse_lazy

class SignUpView(CreateView):
    form_class = UserCreationForm
    template_name = "profiles/signup.html"
    success_url = reverse_lazy('profiles_home')

在urls.py

urlpatterns = patterns('profiles.views',
    url(r'^signup', SignUpView.as_view(), name="profiles_signup"),
    )

我想添加电子邮件,名字和姓氏,......字段。

0 个答案:

没有答案