Did you run 'makemigrations' and 'migrate' after making those changes to your model? I suspect you didn't.
The output of the 'sql' command only shows what would be run if you ran a 'migrate' command, and does not reflect the current state of the database.
The reason the .create() command is succeeding is because the database is allowing the record to be saved. The restrictions you placed in the models.py file only pertain to the DB itself (and forms), and are not checked before a direct save attempt is made. That only happens if validators are specified at the model level.
Try creating a new migration and applying it.
Run 'migrate' anyway even if 'makemigrations' doesn't find any changes. If that's the case, that means you made a new migration but didn't apply it to the database, likely explaining your behavior.
-James
i looked into database directly:
foo=> \d eventsmgmt_subscription
Table « public.eventsmgmt_subscription »
Colonne | Type | Modificateurs
---------------------+--------------------------+--------------------------------------------------------------------------
id | integer | non NULL Par défaut, nextval('eventsmgmt_subscription_id_seq'::regclass)
created_by_id | integer | non NULL
email | character varying(75) | non NULL
as you can see, "not NULL" is in the table
thanks for reply,
--
Gérard Henry