我有几个模型希望在单个管理页面中显示。这是我的模型:
class Server(models.Model):
type = models.CharField(max_length=44, choices=TYPES)
number = models.CharField(max_length=3)
environment = models.CharField(max_length=7, choices=ENVIRONMENTS)
location = models.CharField(max_length=3, choices=LOCATONS)
cpu = models.PositiveSmallIntegerField()
ram = models.PositiveIntegerField()
os = models.CharField(max_length=24, choices=OSs, default='CentOS 6.3')
eth0_ip = models.IPAddressField(unique=True)
eth0_mac = models.CharField(max_length=17, unique=True, null=True,
blank=True)
confluence_page = models.URLField(null=True, blank=True)
class Meta:
abstract = True
def __unicode__(self):
return "%s%s.%s" % (self.type, self.number, self.environment)
class Real(Server):
manufacturer = models.CharField(max_length=20, choices=MANUFACTURERS_REAL)
rack = models.CharField(max_length=6, null=True, blank=True)
rack_u = models.PositiveSmallIntegerField(null=True, blank=True)
serial_num = models.CharField(max_length=8, unique=True, null=True,
blank=True)
class Virtual(Server):
manufacturer = models.CharField(max_length=20,
choices=MANUFACTURERS_VIRTUAL)
host_id = models.ForeignKey(Real)
我想知道是否无论如何我可以创建/扩展/任何允许查看两个数据库中所有对象的管理界面。例如,我可以进入管理员,然后当我单击应用程序名称时,我会获得两个数据库的 change_list,当我选择一个特定对象时,比如一个虚拟,我将获得管理界面来创建或更改一个虚拟对象。
如果我不清楚,请告诉我,我会尽我所能以不同的方式更清楚地解释。