Everything seems fine. As suggested in the comment, most likely when you ran syncdb
the first time, at that time you did not had the options null=True
for dept
and salary_range
. Then you changed your code however that did not modify the table definition. To solve that, you can either manually fix the issue by dropping the NOT NULL
part or you can use database migrations apps. The most popular one is by far South. South can detect changes in the model definitions and apply appropriate changes to your database (called database migrations) without loosing any data. South docs are pretty good so you should be able to start using it in no time.
PS - In future versions of Django (most likely Django 1.7), the migrations capability will be integrated directly into Django core however until then, South will have to do.