[Answered ]-Django profile creation, set User profile while using multiple profile types

2👍

Multiple profile types won’t work with the OneToOne relation that is required by Django profile mechanism. I suggest you keep a single profile class containing data common to all profile types and you store type-specific data in a separate set of classes that you link to your profile class using a generic relation.

EDIT:

Thanks for the clarification. Looking at your code again today it seems that you might indeed be able to accomplish what your trying to do with model inheritance. I think the problem is in the save() method of UserRegistrationForm. Try something like this:

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

Leave a comment