So I got this when trying to add a User to the database. And I thought, I wonder what columns it does have? So I asked for the sql…
DatabaseError: table OmniCloud_App_user has no column named username
>>>
root@Harold:~/OmniCloud/omnicloud# python manage.py sql OmniCloud_App
BEGIN;
CREATE TABLE "OmniCloud_App_user" (
"id" integer NOT NULL PRIMARY KEY,
"email" varchar(75) NOT NULL,
"username" varchar(25) NOT NULL,
"password" varchar(30) NOT NULL
)
;
Hey! There it is! Why would it get mad at the two following lines if it seems to, in fact, have said column?
>>> u = User(email="gmail@gmail.com", username="gmail", password="gmail")
>>> u.save()
Also not how I am defining a User class and it says that user has no column called username. Why does it go lowercase?
$> python manage.py syncdb?Syncdb only works on new models. You’ve got to sort out migrations yourself, and that’s where South comes in.
Alternatively, you can modify the database on your own, or use another app, which is closer to that method, called nashvegas.
This is an approximation of the SQL that you need.