我想创建一个models.Model类,它不会成为数据库的一部分,而只是其他模型的接口(我想避免重复代码).
像这样的东西:
class Interface(models.Model):
a = models.IntegerField()
b = models.TextField()
class Foo(Interface):
c = models.IntegerField()
class Bar(Interface):
d = models.CharField(max_length='255')
Run Code Online (Sandbox Code Playgroud)
所以我的数据库应该只有Foo(带有a,b,c列)和Bar(带a,b,d)但不能有表接口.