I am using django-userena
. I have a model called UserProfile
. I've added extra fields in signup form. and These fields are show up correctly but data is not saved. I want to save some fields data into another Model (Business
) too. For example I've two field like contact
and business
. I want contact field will goes to UserProfile
Model and business
field will goes to Business Model
. any clue? Thank you
Here is my code
class SignupFormExtra(SignupForm):
address = forms.CharField(label=_(u'Address'),max_length=30,required=False)
contact = forms.CharField(label=_(u'Contact'),max_length=30,required=False)
business = forms.CharField(label=_(u'Business Name'),max_length=30,required=False)
def save(self):
"""
Override the save method to save the first and last name to the user
field.
"""
user_profile = super(SignupFormExtra, self).save(commit=False)
user_profile.address = self.cleaned_data['address']
user_profile.contact = self.cleaned_data['contact']
user_profile.business = self.cleaned_data['business']
user_profile.save()
return user_profile
UPDATE : I am storing those values on a User instance... I want toe storing them on Profile model -- an instance that's bound to the User