Required field in Django model not mandatory?
问题 I have the following Django model: class Customer(models.Model): email = models.EmailField(unique=True) In my testcase, I instantiate it without an e-mail. class CustomerTestCase(TestCase): def test_that_customer_can_be_created_with_minimum_data(self): customer = Customer.objects.create() print(customer.__dict__) I expect it to raise an error, but it creates a record with an empty field email . The same thing happens if I explicitly say null=False and blank=False . Instead, it just prints the