我正在创建一个注册表单,以便用户注册。
models.py
class UserProfile(models.Model):
user = models.OneToOneField(User)
address = models.CharField(max_length=100)
我不确定应该在forms.py和views.py中进行什么,因为地址不是用户的一部分,而是UserProfile(UserProfile的扩展名)
我希望能够在forms.py中执行类似的操作:
email = forms.EmailField(label='Your Email')
username = forms.CharField(label='Your Username')
password1 = forms.CharField(label='Password', \
widget=forms.PasswordInput())
password2 = forms.CharField(label='Password Confirmation', \
widget=forms.PasswordInput())
first_name = forms.CharField(label='First Name')
last_name = forms.CharField(label='Last Name')
address = forms.CharField(label='Your Address')