我想根据父级连击的选择来填充从属连击。我的代码如下:
AddPlatformCommandClicked()
从django.contrib导入管理员
从.models导入Species,SpeciesDetail,Pair,
class Species(models.Model):
name = models.CharField(max_length=120, blank=False, null=False)
description = models.TextField(max_length=300, blank=False, null=False)
class SpeciesDetail(models.Model):
species = models.ForeignKey(Species, on_delete=models.CASCADE)
picture = models.ImageField(upload_to='pics')
gender = models.CharField(max_length=1)
health = models.CharField(max_length=120)
class Pair(models.Model):
species = models.ForeignKey(Species, on_delete=models.CASCADE)
male = models.ForeignKey(SpeciesDetail, on_delete=models.CASCADE, related_name='male_set')
female = models.ForeignKey(SpeciesDetail, on_delete=models.CASCADE, related_name='female_set')
答案 0 :(得分:0)
答案是DAL(Django Autocomplete Light。