0

I am using models in following way:

class UserProfile:
# Some Stuff

class CompanyProfile(UserProfile):
# Some more stuff

class CandidateProfile(UserProfile):
# Even more stuff

mean CompanyProfile and CandidateProfile are inheriting from UserProfile . How will I populate these CompanyProfile and CandidateProfile from whether registrationform and from another profileform? How will I tell it that which profile I am creating a user or entering data?

Hafiz
  • 4,187
  • 12
  • 58
  • 111
  • @Adam yes, this question is older one and have now figured it out, will post answer in few hours here – Hafiz Jun 03 '12 at 09:50

1 Answers1

0

I did it in following way that is in another thread on stackoverflow.com here : django user profile creation,set user profile while using multiple profile types , code is following:

def save(self, commit=True):
user = super(UserRegistrationForm, self).save(commit=False)
user.email = self.cleaned_data["email"]
if commit:
    user.save()
    person = Person(user=user)
    person.full_name = self.cleaned_data["fullname"]
    person.save()
return user
Community
  • 1
  • 1
Hafiz
  • 4,187
  • 12
  • 58
  • 111