我有一个模特单位。
class Unit(CommonInfo):
version = IntegerVersionField( )
number = models.CharField(max_length=30,null=True, blank=True)
max_occupants = models.PositiveSmallIntegerField()
floor = models.PositiveSmallIntegerField()
rooms = models.PositiveSmallIntegerField()
is_disabled_access = models.BooleanField(default=False)
balcony_quantity = models.PositiveSmallIntegerField()
building = models.ForeignKey(Building)
recomended_price = models.DecimalField(max_digits=7, decimal_places=2)
每个单位都具有在属性表
中定义的所有属性class Property1(CommonInfo):
unit = models.ForeignKey(Unit)
is_true = models.BooleanField(default=False)
propertytype = models.ForeignKey(Propertytype, related_name='propertytype')
date = models.DateTimeField(null=True, blank=True)
followup_date = models.DateTimeField(null=True, blank=True)
quantity = models.PositiveSmallIntegerField()
有没有办法大规模创建具有默认值的所有单位的所有属性?