1π
β
Why Django complains about an myt_userdata.id may not be null?
Because id
is not a primary key and is not populated automatically though. Also, you donβt provide it on model creation, so DB does not know what to do.
Does Django tries to relate to the underline db structure, how? (for example the not NULL message comes from the model or from the DB?)
Itβs an error from DB, not from Django.
You can use sql command to understan what exactly is executed on syncdb. Variant above seems to be correct table definition made from correct Django model, and I have no ide how have you got a variant below. Write a correct and clear model, and youβll get correct and working table scheme after syncdb
π€ilvar
Source:stackexchange.com