我很难用文字来解释我需要什么,所以我这里有一些代码:
class Configuration(models.Model):
name = models.CharField(max_length=250)
firmware_version = models.ForeignKey(FirmwareVersion)
devices_amount = models.PositiveIntegerField()
def __unicode__(self):
return unicode(self.name)
class Firmware(models.Model):
name = models.CharField(max_length=250)
circuit_model = models.ForeignKey(Versiiplates)
def __unicode__(self):
return unicode(self.name)
class FirmwareVersion(models.Model):
firmware = models.ForeignKey(Firmware)
version = models.CharField(max_length=100)
file = models.FileField(upload_to="firmware/")
upload_date = models.DateField(default = datetime.date.today())
notes = models.TextField(max_length=2500, null=True, blank=True)
def __unicode__(self):
return u'%s %s' % (self.firmware.__unicode__(), self.version)
有没有办法在管理员更改表单中选择先配置固件,然后再选择与之相关的任何固件版本?