在Test2课程中,我想在其Meta类中包含模型和字段。这可能吗?怎么样?这就是我试过的......
我有一个混音:
class Test1(object):
pass
class Meta:
fields = ("url",)
class Test2(Test1):
pass
class Meta:
super(Meta) <=== does not work
models= test
答案 0 :(得分:7)
您的答案可以在Django Documentation
中找到即
from django.db import models
class CommonInfo(models.Model):
# ...
class Meta:
abstract = True
ordering = ['name']
class Student(CommonInfo):
# ...
class Meta(CommonInfo.Meta):
db_table = 'student_info'