2👍
A few questions
- What version of django are you using?
- What database are you using?
- If you look at your database record after you save via the shell what is in the database for create_date?
- If you look at the schema definition for the table in the database does it allow nulls for create_date? Is there a default set?
I haven’t had a chance to try this code out yet, but this is my guess as to what is going on.
The django admin is using form validation to stop you from saving, and giving you the error.
When you use the shell the model doesn’t have validation, so it is allowing you to save, and it is relying on the database to catch the issues with the nullable data. My guess is that your database is allowing this value to be null and isn’t throwing an error and thus it allows you to save with no issues.
In Django 1.2 they added model validators that are similar to form validators, check out this link for more info.
http://docs.djangoproject.com/en/1.2/ref/models/instances/#validating-objects
Once again, I’m just taking a guess here since I don’t know the answers to the questions above. If you could get me those answers I should be able to give you a better answer.