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

  • SEARCH
  • Home
  • 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 7439209
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 29, 20262026-05-29T10:40:23+00:00 2026-05-29T10:40:23+00:00

Regarding Django & Python: The Error: Exception Type: DatabaseError Exception Value: column objects_thing.name_id does

  • 0

Regarding Django & Python:

The Error:

Exception Type: DatabaseError
Exception Value:
column objects_thing.name_id does not exist
LINE 1: …s_thing”.”created”, “objects_thing”.”modified”, “objects…

In my manage.py sql objects

CREATE TABLE "objects_thing" (
    otherstuff,
    otherstuff,
    "name_id" integer NOT NULL REFERENCES "profiles_name" ("id"),
    otherstuff,
);

So it clearly exists.
I’ve ran syncdb.
Why am I getting this error? And how do I go about fixing it? (I’m a newbie to all of this) Thank you in advance for the help.

EDIT:

Thing Model:

class Thing(models.Model):
    created = models.DateTimeField(auto_now_add=True)
    modified = models.DateTimeField(auto_now=True)
    name = models.ForeignKey(Name)#The name for this thing
    current_allocation = models.DecimalField(max_digits=13, decimal_places=2, null=True, blank=True)
    target_allocation = models.DecimalField(max_digits=13, decimal_places=2, null=True, blank=True)
    placeholder = models.ForeignKey(Entity, null=True, blank=True, on_delete=models.SET_NULL)
    avatar = models.ImageField(upload_to='avatars/thing/', null=True, blank=True)
  • 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-29T10:40:24+00:00Added an answer on May 29, 2026 at 10:40 am

    syncdb doesn’t change existing tables in your database, so if you run that, and then change your model, your model is now out of sync with the table it represents. Running syncdb again will not fix that.

    You either need to use something like south to do a migration, delete the table from your DB so that syncdb will recreate it, or manually run an ALTER TABLE on your DB.

    EDIT (greater detail)

    When you create a subclass of Model in models.py, it acts as a representation of a database table, but doesn’t automatically have a database table. You get that by running python manage.py syncdb. Django, then, looks through all your models.py files, generates the SQL required to actually create a table like that and then runs it on your database. The end result is that you end up with actual database tables that are tied to your models.

    However, syncdb only creates tables. It does not alter them. So, if you go and change one of your models (add a field, change the name of a field, etc.), nothing has happened at the database level. Running syncdb again will not help, either, because there’s no new tables to create. You have to somehow get the table to match the model and vice versa, though, so that’s where your options come in:

    1. Use South (link above). South enables you to create migrations, so when you change something on your models you can run:

      python manage.py schemamigration --auto yourapp
      

      And it will generate code that will alter the table to match your model. You then need only apply the migration with:

      python manage.py migrate yourapp
      

      And you’re done. The table now matches your model and all is right in the world again.

    2. You can manually delete the table from your database. You wouldn’t want to do this in production because all the data in that table will go along with it, but in development it shouldn’t be a problem. After the table is gone, you can then run:

      python manage.py syncdb
      

      Because, the table no longer exists, Django will create it, but it will create it based on your current model’s state. The net result is the same, your model and table match, so you’re good to go.

    3. You can manually alter the table. This requires that you figure out what SQL needs to be applied to change the table to match your model. You run this SQL on your database, and then the table is in parity with the model.

    The point is that somehow, someway, you must update the table to reflect any changes you make to your models. The model isn’t the table, it’s just a programmatic representation of it.

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

Sidebar

Related Questions

I am new to python and django and i have a question regarding the
There's lots of good conference videos online regarding Python and Django development. Instead of
Regarding TJvRichEdit and Delphi... How? Load/Save rtf (including text and images - not only
I have some doubts regarding sitemap.xml generation and Django's sitemap framework particularly. Let's say
I have a couple of conceptual questions: regarding serving static files (media) in Django
Question Why does Django automatically load the initial_data.json fixture when it's located inside the
My question is regarding i18n in Python. From what I understand, it involves: Create
Regarding setting Django's USE_I18N = False in settings.py the documentation say: A boolean that
I'm following Beginning Django E-Commerce but I found a part regarding user profiles a
I am working on an application in Python/Django. I am trying to make a

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.