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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 22, 20262026-05-22T15:58:27+00:00 2026-05-22T15:58:27+00:00

I have a Profile model that is used to define a profile for a

  • 0

I have a Profile model that is used to define a profile for a User from the auth application. Also, I have a signal that will create an empty profile each time a user is created.

The problem is that, when starting from clean, the Profile table is created after the User table, so, when I am asked to add the super user, my signal function fails, because there is no Profile table to enter the empty profile.

Is there a way to force in which order the tables should be created by the syncdb, so that the profile table should already be created when the super user is added ?

  • 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-22T15:58:28+00:00Added an answer on May 22, 2026 at 3:58 pm

    Do one of the following:

    1. Modify your signal to catch this specific error (table does not exist) and ignore it. Won’t help if you need to have Profile for superuser too.

    2. Do not insert any data before whole DB schema is initialized. You don’t have to create superuser during syncdb, this can be done later from dev console (django-admin.py shell) or you could put superuser’s User and Profile to your app’s initial_data.json fixture that is loaded automatically during syncdb. This will reset it’s information on ever syncdb, but in certain cases it’s acceptable.

    3. Use AutoOneToOneField from django-annoying lib to automatically create Profile the first time it’s accessed. This is how I’d solve this problem myself — no need to redo existing functionality with signals. Here’s an example from their wiki:

      from annoying.fields import AutoOneToOneField
      
      class MyProfile(models.Model):
          user = AutoOneToOneField(User, primary_key=True)
      
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I have a user model (sql table) that has_one : profile. profiles have user_id
I have a user model. In it, I have set validations that are used
I have a database that hold's a user's optional profile. In the profile I
I have created a Profile model including the Gender info. There is also models
I have a Django project, that has a Address model. This is used in
I have a user and a profile model. One user can have many profiles.
I have a profile class: class profile(db.Model): user = db.stringProperty() # Other properties ...
I have a DLL that I want to profile.. I tried to use Very
This is something that I have always wondered about, but never bothered to profile.
I'm using a user profile model with a ForeignKey to the User, authenticated by

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.