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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 21, 20262026-05-21T08:39:25+00:00 2026-05-21T08:39:25+00:00

Using Django 1.2, I’m running the django-registration application, and creating a User Profile object

  • 0

Using Django 1.2, I’m running the django-registration application, and creating a User Profile object after registration created the user – using code that came from some other Questions:

# models.py
def create_player_profile(sender, instance, created, **kwargs):
    signals.post_save.disconnect(create_player_profile, sender = User) # added.
    if created:
        print "creating profile."
        profile, created = PlayerProfile.objects.get_or_create(user = instance)
        print "profile %s created = %s" % (str(profile), str(created))
    else:
        print "problems creating profile."

signals.post_save.connect(create_player_profile, sender = User)

And it works fine 🙂 The only problem is, I get two sets of output, indicating that the code is running twice. I suspect that for some reason, the signal is getting sent twice.

My first thought is that the file is getting imported twice, setting up two identical signals. Which makes me wonder if maybe django-registration is doing something automatically? Or something else I don’t yet understand about Django. 🙂

So why is the code running twice? Are two signals being sent, and if so, why?

Update Just noticed this Answer explained how to avoid duplicate signals. And it worked, somewhat 🙂 My output went from:

creating profile.
creating profile.
problems creating profile
problems creating profile

to:

creating profile.
problems creating profile

I don’t know if that means my code was originally running four times? And dropped down to only two times? I’m so confused. 🙂

Update 2 – added the signals.disconnect line. I figured deleting the signal would prevent the function from executing twice. Alas, I was wrong – create-player-profile is still running twice… I have no clue why it would, if the signal was immediately deleted.

  • 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-21T08:39:26+00:00Added an answer on May 21, 2026 at 8:39 am

    Update: removed this stuff about AUTH_PROFILE_MODULE

    So why is the code running twice? Are
    two signals being sent, and if so,
    why?

    I guess the problem is not that the signal is called twice, but your User.save() method is called twice somewhere (and therefore the signal as well). Maybe you should check this one first.

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

Sidebar

Related Questions

I'm using Django and Python 2.6, and I want to grow my application using
I'm rewriting a PHP+MySQL site that averages 40-50 hits a day using Django. Is
I have been using Django for web-development, and have become quite fond of that
I've been using Django and Django passes in a request object to a view
Using Django's built in models, how would one create a triple-join between three models.
I'm considering using Django for a project I'm starting (fyi, a browser-based game) and
I'm using Django to write a blog app, and I'm trying to implement a
I am having problems using django-tagging . I try to follow the documentation but
I'm using django and when users go to www.website.com/ I want to point them
I am currently using Django to construct JSON encoded objects which a retrieved using

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.