我知道Django有基于类的通用视图,这使我们能够(例如注册)注册用户,但它有一点选项,我想为它添加更多字段,我该怎么做? 感谢;
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')
urlpatterns = patterns('profiles.views',
url(r'^signup', SignUpView.as_view(), name="profiles_signup"),
)
我想添加电子邮件,名字和姓氏,......字段。