params = {'value':value},django.core.exceptions.ValidationError:[“”值必须为True或False。“]

时间:2019-12-08 12:54:05

标签: django model

这是我的代码,我刚刚开始学习ddjango并被卡在这里。在收到其他错误几天后,我又添加了地址和状态

  

params = {'value':value},django.core.exceptions.ValidationError:[“''值必须为True或False。”]

from django.db import models


class product(models.Model):
    prodid = models.IntegerField(("ID"))
    name = models.CharField(("Product Name"), max_length=100,unique ="true")
    price = models.IntegerField()
    star = models.IntegerField()


    def __str__(self):
        return self.name 


    class cart (models.Model):
        product = models.ForeignKey(product , on_delete=models.CASCADE)
        quantity = models.IntegerField()
        address = models.CharField(("Address"), max_length=300, default='')
        status = models.BooleanField(default=True)

        def __str__(self):
            return product

0 个答案:

没有答案