更新时间:2023-02-05 17:01:40
由于您的父母模式旨在抽象,您应该将其标记为这样。
Since your parent model is intended to be abstract, you should mark it as such.
class BusinessEntity(models.Model):
title = models.CharField(max_length=180)
class Meta:
abstract = True
这样可以防止Django为它创建一个单独的表,因此需要一个 _ptr
字段从子类指向它。相反,您的子类的表将被创建为直接包含继承的字段。
This prevents Django from creating a separate table for it, and therefore needing a _ptr
field to point back to it from the subclass. Instead, the table for your subclass will be created to include the inherited field(s) directly.