Integrityerror In Django
Solution 1:
On your field:
mail_lists = models.ManyToManyField(Mailists, blank=True)
you have added blank=True
to the field, but not null=True
. This means that your DB is expecting that field to have a value. So when it doesn't you get an error.
If True, Django will store empty values as NULL in the database. Default is False. Note that empty string values will always get stored as empty strings, not as NULL. Only use null=True for non-string fields such as integers, booleans and dates. For both types of fields, you will also need to set blank=True if you wish to permit empty values in forms, as the null parameter only affects database storage (see blank).
If True, the field is allowed to be blank. Default is False.
Note that this is different than null. null is purely database-related, whereas blank is validation-related. If a field has blank=True, form validation will allow entry of an empty value. If a field has blank=False, the field will be required.
Here are some other explanations:
Post a Comment for "Integrityerror In Django"