我的产品变化如下。它可以工作,但只允许我添加额外的10个变种。我需要添加25种产品。如何更改它以便我可以在模型中添加10个以上的变体?
class Variation(models.Model):
product = models.ForeignKey(Product)
title = models.CharField(max_length=120)
price = models.DecimalField(decimal_places=2, max_digits=20)
sale_price = models.DecimalField(decimal_places=2, max_digits=20, null=True, blank=True)
active = models.BooleanField(default=True)
inventory = models.IntegerField(null=True, blank=True) #refer none == unlimited amount
def __unicode__(self):
return self.title
答案 0 :(得分:0)
感谢@neverwalkaloner我检查了我的admin.py并且它有max_num = 10
所以我现在已将其更改为25,因为:
class VariationInline(admin.TabularInline):
model = Variation
extra = 0
max_num = 25
现在限制为25.