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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 6, 20262026-06-06T09:25:04+00:00 2026-06-06T09:25:04+00:00

hi i am working on a django python application using sqlite3 database. I have

  • 0

hi i am working on a django python application using sqlite3 database. I have a an extention to django’s user model defined in my models.py as follows:

#Account Model
class Account(models.Model):
  user = models.OneToOneField(User)
  avatar_url = models.CharField(max_length=200)
  profile_url = models.CharField(max_length=200)
  account_type = models.CharField(max_length=60, choices=choices.ACCOUNT_TYPE)

i also have a method to create the Account object and a post_save handler defined like this:

#Function to Create user Account/Profile
def create_user_account(sender, instance, created, **kwargs):
  if created:
    models.Account.objects.create(user=instance)

#Create User / User Registration
def UserRegistration(request):
  if request.method == 'POST':
    username = request.POST['fn'].capitalize() + ' ' + request.POST['ln'].capitalize()
    # CREATE USER
    newuser = User.objects.create_user(username=username,
                                       email=request.POST['email'],
                                       password=request.POST['pw'])
    newuser.save()
  return HttpResponse(username)

#Post Save handler to create user Account/Profile
post_save.connect(create_user_account, sender=User)

Now, whenever i try to register a new user i get the following database error:

DatabaseError at /register/

table engine_account has no column named user_id

Request Method:     POST
Request URL:    http://localhost:8000/register/
Django Version:     1.4
Exception Type:     DatabaseError
Exception Value:    

table engine_account has no column named user_id

Exception Location:     /usr/local/lib/python2.7/dist-packages/Django-1.4-py2.7.egg/django/db/backends/sqlite3/base.py in execute, line 337
Python Executable:  /usr/bin/python
Python Version:     2.7.3

and i have no idea where that "user_id" field is coming from .. any ideas ?

PS:

table engine_account is basically the Account class in the application named Engine

  • 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-06-06T09:25:05+00:00Added an answer on June 6, 2026 at 9:25 am

    Did you edit models.py after you ran syncdb?

    If so,then you should manually edit your table or recreate your database using:

    python manage.py syncdb
    

    in project directory to apply the changes.


    Update 2019 : syncdb is deprecated in Django 1.9 onwards. Use

    python manage.py makemigrations <app_name>
    python manage.py migrate --run-syncdb
    

    Update 2020 : I would like to add more description to my answer.

    This problem occurs if the model and the corresponding table does not match. This means you have altered your model but not migrated your changes. Some do not get the difference between makemigrations and migrate commands. To make it more clear, I will try to explain the difference:

    ./manage.py makgemigrations <app_name>: The changes on the models of given app will compared with the previous migrations. If no app_name is provided all of the tracked apps will be controlled and if has any changes the migrations will be created. Each app has its migrations directory and this command will create the related migrations inside this directory. When a migration is created it has no changes on the DB, the migrations needs to be applied. If you do not apply your migrations then you will still get the same error.

    ./manage.py migrate: The migrations created by makemigrations command is applied to DB. You need to be careful while you are migrating on the production environment.

    ./manage.py showmigrations: This command lists the statuses of the migrations, you can see if a migration is applied or not. Normally the statuses are stored in the DB, but there is no need to connect to db and crawl the data. This command gives you a clear input.

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

Sidebar

Related Questions

I have a web application im currently working on in python. I'm using Django
I am working on a web application using Python (Django) and would like to
I'm currently working on a social web application using python/django. Recently I heard about
I need to have an at-home project now that I'm working on Python/Django at
I am trying to make an chat application using python and django. I almost
Imagine you have a web application written in Django and Python 2.65, and MySQL
I am working on an application in Python/Django. I am trying to make a
I have a new Django application I am working on. I have the following
I'm working through the design of a Django inventory tracking application, and have hit
I have a Django application using django-mssql to communicate w/ SQL Server. This works

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.