开发者

django: daterangefield attribute error

I get this error 'int' object has no attribute 'days' in trace this is highlighted camp.save()开发者_如何学运维

My model class:

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()

My view:

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)

what could be the issue?

0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜