我收到此错误'int'对象在跟踪中没有属性'days',突出显示camp.save()
我的模特课:
class Campaign(models.Model):
time_to_next = DateTimeRangeField()
rank = models.PositiveIntegerField()
address = models.ForeignKey(Address)
description = models.CharField(max_length = 200)
display = models.BooleanField()
date_created = models.DateField(auto_now_add=True)
url = models.URLField()
current_promotion = models.ForeignKey(Promotion, related_name="campaign_current_promotion")
promotions = models.ManyToManyField(Promotion)
enabled = models.BooleanField()
我的观点:
camp = campaign.save(commit=False)
camp.business = bdns
camp.time_to_next = 2
camp.rank = 1
camp.address = addr
camp.display = 1
camp.url = 'http://test1.com'
camp.current_promotion = promo
camp.enabled = True
camp.save()
cp = promo
camp.promotions.add(cp)
可能是什么问题?