2
Actually you need to add null=True
in the img field, So make it img = models.ImageField(upload_to='images', blank=True, null=True)
.
The difference is that because blank=True
decides that whether the fields will be required by the forms. blank=False
means that field cannot be blank and blank=True
means field will not be required.
Regarding null=True
sets NULL in column of your DB which will solve your issue.
Source:stackexchange.com