添加姓名到pinax帐户



如何更改Pinax帐户应用程序以获取姓名等信息?因为我找不到任何特定的解决方案,最好使用django注册。我是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()

我没有注意到,但访问http://django-user-accounts.readthedocs.org/en/latest/usage.html有了以上问题的答案

相关内容

  • 没有找到相关文章

最新更新