Tumbe
Tumbe

Reputation: 46

Pinax - Customizing the sign up process - get_profile()

Trying to edit Pinax django-user-account sign up process with help of this document: http://django-user-accounts.readthedocs.org/en/latest/usage.html#customizing-the-sign-up-process

I have attached these to my views.py as instructed:

    def after_signup(self, form):
    self.create_profile(form)
    super(SignupView, self).after_signup(form)

def create_profile(self, form):
    profile = self.created_user.get_profile()

    profile.firstname = form.cleaned_data["firstname"]
    profile.save()

Well, getting error "'User' object has no attribute 'get_profile'". I'm using Django 1.7.6 and according to documentation get_profile() has been removed from Django 1.7. How should I change profile getting?

Upvotes: 0

Views: 213

Answers (1)

Seenu S
Seenu S

Reputation: 3481

Even i got the same error you mentioned. We will specify the AUTH_PROFILE_MODULE=account.UserProfile.But The AUTH_PROFILE_MODULE setting, and the get_profile() method on the User model, will be removed. follow this link http://deathofagremmie.com/2014/05/24/retiring-get-profile-and-auth-profile-module/

I'm try to using the code like this. It worked for me.

def create_profile(self, form):
    profile = self.created_user.profile
    # you can use this line to either one of it will work
    # profile = self.created_user
    profile.firstname = form.cleaned_data["firstname"]
    profile.save()

Upvotes: 1

Related Questions