python - 我的 Django models.py 文件中有一个验证错误
问题描述
我正在使用 models.py 文件在 Django 中创建一个表,当我运行代码时,它会给出一个验证错误,如下所示:
django.core.exceptions.ValidationError: ['“null” value must be either True or False.']
这是我的 models.py 文件
from django.db import models
class Users:
id = models.IntegerField(primary_key=True)
first_name = models.CharField(max_length=250)
last_name = models.CharField(max_length=250)
username = models.CharField(max_length=50)
password = models.CharField(max_length=300)
birthday = models.DateField(auto_now_add=False)
date_created = models.DateTimeField(auto_now_add=True)
terms_confirmed = models.BooleanField(default=False)
我已经尝试用布尔值注释掉字段,并挑选出每一行以查看它是否会产生错误
解决方案
推荐阅读
- python - 分类器的性质和冗余
- c# - 在哪里可以找到 Windows.UI.Xaml.Media.Imaging 命名空间?
- android - 将文本和图像添加到 ListView?
- python - scikit-learn 中的交叉验证:(X_test, y_test) 的平均绝对误差
- c++ - C++ 外部的垃圾收集
- gradle - 错误:包 android.test 不存在
- python - 使用没有 wtforms 的烧瓶进行表单验证
- html - 定位一个元素,但希望所有后续元素相应地定位
- javascript - 支持原生模块的 JavaScript 测试运行器
- sql - 用值和显示成员填充组合框。自定义类与基本 SQL 字符串