Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • Home
  • SEARCH
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 7077619
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 28, 20262026-05-28T06:26:46+00:00 2026-05-28T06:26:46+00:00

I am using django-userena . I have a model called UserProfile . I’ve added

  • 0

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

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-05-28T06:26:47+00:00Added an answer on May 28, 2026 at 6:26 am

    Author of Userena here. I already had an e-mail correspondence with “no_access”, but it’s worth pointing to the solution if others have the same problem. The first mistake was that the save method returns a profile. This is not true, it returns a Django User. Because of this you first have to fetch the profile and make the changes to it. Save the profile and then return the user again to keep it compatible with Userena.

    For the Business model, just add it in the save method also.

    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.
    
            """
            # Original save method returns the user
            user = super(SignupFormExtra, self).save()
    
            # Get the profile, the `save` method above creates a profile for each
            # user because it calls the manager method `create_user`.
            # See: https://github.com/bread-and-pepper/django-userena/blob/master/userena/managers.py#L65
            user_profile = user.get_profile()
    
            # Be sure that you have validated these fields with `clean_` methods.
            # Garbage in, garbage out.
            user_profile.address = self.cleaned_data['address']
            user_profile.contact = self.cleaned_data['contact']
            user_profile.save()
    
            # Business
            business = self.cleaned_data['business']
            business = Business.objects.get_or_create(name=business)
            business.save()
    
            # Return the user, not the profile!
            return user
    

    After creating the form, don’t forget to override the userena form in your urls.py. Something like this will do:

    url(r'^accounts/signup/$',
            userena_views.signup,
            {'signup_form': SignupFormExtra}),
    

    That should do the trick! Good luck.

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I using Django and a generic view django.views.generic.create_update.create_object I have a model form wich
Using django-contact-form , I have overridden the form class: from contact_form.forms import ContactForm from
Am using django forms on my app. I have a model Client like this:
Using Django with a PostgreSQL (8.x) backend, I have a model where I need
I just started using django for development. At the moment, I have the following
Using Django 1.1.1 In models.py: class Site(models.Model): name = models.CharField(max_length=50) class SiteMonth(models.Model): site =
Am using Django's form for my login page. I want to set focus to
Im using Django 1.3.1.In my django code, i have the following template for the
When using django.contrib.comments is there anyway to add the reverse relationship to a model
I'm using django and jquery to implement authenticated sessions and Ajax requests. I have

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.