【问题标题】:add firstname lastname to pinax account将名字姓氏添加到pinax帐户
【发布时间】:2013-06-13 11:46:27
【问题描述】:

如何更改 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()

【问题讨论】:

  • 一天结束,它仍然是 django。 {{request.user.first_name}} 不起作用?
  • 你能详细说明在哪里添加这个吗?我是一个完全的新手......
  • 您想在哪里访问 first_name、last_name 等?
  • 我想将它们保存到用户表中的数据库中,但是视图中没有传递请求的位置。

标签: django pinax


【解决方案1】:

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

【讨论】:

    猜你喜欢
    • 2016-02-22
    • 2014-06-06
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 2018-03-17
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    相关资源
    最近更新 更多