如何更改 Pinax 帐户应用程序以获取名字、姓氏等信息?由于我找不到任何特定的解决方案,最好使用 django-registration。我是 django Pinax 的新手
这是forms.py文件
from django import forms
from django.forms.extras.widgets import SelectDateWidget
import account.forms
from django.forms.widgets import Widget
class SignupForm(account.forms.SignupForm):
birthdate = forms.DateField(widget=SelectDateWidget(years=range(1910, 1991)))
firstname = forms.CharField()
from .forms import SignupForm
class SignupView(account.views.SignupView):
form_class = SignupForm
def after_signup(self, form):
self.create_profile(form)
super(SignupView, self).after_signup(form)
def create_profile(self, form):
profile = self.created_user.profile
profile.birthdate = form.cleaned_data["birthdate"]
profile.save()