Django – extra fields for user form
|July 24, 2014||Posted by forumadmin under TechQns||
In the site I’m developing I have a form to register users that extends the
userCreationForm. Said form only adds fields that are not in the default, but they are in the model such as email, first_name and last_name.
class RegisterForm(UserCreationForm): email = forms.EmailField(label = "Email", required=True) first_name = forms.CharField(label = "First name", required = True ) last_name = forms.CharField(label = "Last name", required = True) class Meta: model = User fields = ("username", "first_name", "last_name", "email", "password1", "password2" ) def __init__(self, *args, **kwargs): super(RegisterForm, self).__init__(*args, **kwargs) for fieldname in ['username', 'password1', 'password2']: self.fields[fieldname].help_text = None
My question is if there’s a way to add another field like an imagefield, date of birth, etc. so that I can make a more complete user profile? Or do I have to create my own user model?
|Asked By – HardCodeStuds||Read Answers|