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 7177323
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 28, 20262026-05-28T16:41:22+00:00 2026-05-28T16:41:22+00:00

When i try to save data to fields in my UserProfile Django raises an

  • 0

When i try to save data to fields in my UserProfile Django raises an typeerror.

I thought that i extended the UserProfile correctly.

My userProfile model:

class UserProfile(models.Model):
    user = models.OneToOneField(User, unique=True, related_name='profile')
    ....
    initials = models.CharField(max_length=5)

User.profile = property(lambda u: UserProfile.objects.get_or_create(user=u)[0])

In my settings i have added:

AUTH_PROFILE_MODULE = 'timepiece.UserProfile'

When i run a test which should insert values into inherited fields from User, i get an TypeError:

(erp)BAir:website jorrit$ ./manage.py test timepiece.PivotalTest.test_update_users
Creating test database for alias 'default'...
E
======================================================================
ERROR: test_update_users (timepiece.tests.pivotal.PivotalTest)
----------------------------------------------------------------------
Traceback (most recent call last):
  File "/Users/jorrit/virtualenvs/erp/erp/apps/timepiece/tests/pivotal.py", line 73, in test_update_users
    UserProfile.sync_pivotal_users(self.tracker, 450001)
  File "/Users/jorrit/virtualenvs/erp/erp/apps/timepiece/models.py", line 44, in sync_pivotal_users
    initials = m.initials,)
  File "/Library/Python/2.7/site-packages/django/db/models/base.py", line 365, in __init__
    raise TypeError("'%s' is an invalid keyword argument for this function" % kwargs.keys()[0])
TypeError: 'username' is an invalid keyword argument for this function

----------------------------------------------------------------------
Ran 1 test in 1.857s

The function which is tested:

def sync_pivotal_users(tracker, project_id):
    members = tracker.get_memberships_project(project_id)

    for m in members:
    #check if member exist in db
        try:
            #to know if m.id exists in current db
            UserProfile.objects.get(pivotal_member_id=m.id)
            #if not then create a new user
        except UserProfile.DoesNotExist:
            u = UserProfile(pivotal_member_id = m.id,
                            username = m.name, #code breaks here
                            email = m.email, # and here 
                            initials = m.initials,)
            u.save()
  • 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-28T16:41:23+00:00Added an answer on May 28, 2026 at 4:41 pm

    The idea behind the approach outlined in the documentation is that when a new User object is created, you attach a handler that in turn creates a UserProfile object:

    The method get_profile() does not create a profile if one does not exist. You need to register a handler for the User model’s django.db.models.signals.post_save signal and, in the handler, if created is True, create the associated user profile

    so in your loop through members, you should be creating User objects, not UserProfile objects, as they will automatically be created via the signal.

    It’s not really clear how you are getting passwords (the sign up process), but once you have those, you can update the profile for that user using

    profile = current_user_obj.get_profile()
    profile.initial = "some value"
    profile.save() 
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I try to create a form that can save a person's form data so
I have the following model set up: class UserProfile(models.Model): Additional attributes for users. url
according to this image, i try to save data in NSUserDefaults but my App
I have a django form that first validates its data through calling form.is_valid(). If
I have a class Data which implements Serializable interface. This class has such fields
When i try to create or save a date in the model the validation
When I try and save something to my list in SharePoint I get the
I try to create a new file inside a JSP and try to save
I have a POST controller action like: if (ModelState.IsValid) { try { //.. save
Try as I might I cannot get my head around what the IteratorIterator class

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.