From cfdf8f01af144b7cc9028b5a36861d5b2e68ebab Mon Sep 17 00:00:00 2001 From: pk6lqz7py <18020194653@163.com> Date: Sun, 9 Nov 2025 21:23:06 +0800 Subject: [PATCH] =?UTF-8?q?=E6=B3=A8=E9=87=8A?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../migrations/0002_alter_comment_is_enable.py | 13 +++++++------ 1 file changed, 7 insertions(+), 6 deletions(-) diff --git a/src/DjangoBlog-master/comments/migrations/0002_alter_comment_is_enable.py b/src/DjangoBlog-master/comments/migrations/0002_alter_comment_is_enable.py index 17c44db..2a1a653 100644 --- a/src/DjangoBlog-master/comments/migrations/0002_alter_comment_is_enable.py +++ b/src/DjangoBlog-master/comments/migrations/0002_alter_comment_is_enable.py @@ -2,17 +2,18 @@ from django.db import migrations, models - +# 数据库迁移:修改评论模型字段默认值 class Migration(migrations.Migration): - + # 依赖项:需要先执行comments应用的0001_initial迁移 dependencies = [ ('comments', '0001_initial'), ] - + # 数据库操作列表 operations = [ + # 修改is_enable字段:将默认值从True改为False(评论默认不显示) migrations.AlterField( - model_name='comment', - name='is_enable', - field=models.BooleanField(default=False, verbose_name='是否显示'), + model_name='comment',#模型名称 + name='is_enable',#字段名称 + field=models.BooleanField(default=False, verbose_name='是否显示'),# 新字段定义 ), ]