我正在使用 django-userena 身份验证。我正在尝试将模型中的性别定义模型引用到 forms.py 中以显示在用户注册中,但它在关键字 arg 之后的非关键字 arg 处显示 SyntaxError(forms.py,第 23 行)。我不知道如何正确引用它。请帮忙!!!
模型.py:
class Profile(UserenaLanguageBaseProfile):
GENDER_CHOICES = (
(1, _('Male')),
(2, _('Female')),
)
gender = models.PositiveSmallIntegerField(_('gender'),
choices=GENDER_CHOICES,
blank=False,
null=False)
表格.py:
from django import forms
from userena.models import UserenaLanguageBaseProfile
from accounts.models import Profile
from userena.forms import SignupForm
class SignupFormExtra(SignupForm):
gender = forms.PositiveSmallIntegerField(label=_(u'Gender'),
'gender',
required=True)
first_name = forms.CharField(label=_(u'First name'),
max_length=30,
required=True)
last_name = forms.CharField(label=_(u'Last name'),
max_length=30,
required=True)