From 41f1aa45fb8a5befd83c04e23d6209ff2f17674e Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E9=A1=BE=E6=80=9D=E7=94=9C?= <3593988069@qq.com> Date: Sun, 9 Nov 2025 21:23:49 +0800 Subject: [PATCH] =?UTF-8?q?=E6=B7=BB=E5=8A=A0=200002=5Falter=5Fcomment=5Fi?= =?UTF-8?q?s=5Fenable.py=20=E6=B3=A8=E9=87=8A?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../0002_alter_comment_is_enable.py | 21 +++++++++---------- 1 file changed, 10 insertions(+), 11 deletions(-) diff --git a/djangoblog/src/DjangoBlog-master/DjangoBlog-master/comments/migrations/0002_alter_comment_is_enable.py b/djangoblog/src/DjangoBlog-master/DjangoBlog-master/comments/migrations/0002_alter_comment_is_enable.py index 17c44db8..f53c7de0 100644 --- a/djangoblog/src/DjangoBlog-master/DjangoBlog-master/comments/migrations/0002_alter_comment_is_enable.py +++ b/djangoblog/src/DjangoBlog-master/DjangoBlog-master/comments/migrations/0002_alter_comment_is_enable.py @@ -1,18 +1,17 @@ # Generated by Django 4.1.7 on 2023-04-24 13:48 +from django.db import migrations, models # gst: 导入数据库迁移和模型字段相关模块 -from django.db import migrations, models +class Migration(migrations.Migration): # gst: 定义迁移类,管理数据库模型的修改操作 -class Migration(migrations.Migration): - - dependencies = [ - ('comments', '0001_initial'), + dependencies = [ # gst: 迁移依赖项,指定执行当前迁移前需完成的其他迁移 + ('comments', '0001_initial'), # gst: 依赖comments应用的0001号初始迁移(确保Comment模型已存在) ] - operations = [ - migrations.AlterField( - model_name='comment', - name='is_enable', - field=models.BooleanField(default=False, verbose_name='是否显示'), + operations = [ # gst: 迁移操作列表,定义当前迁移要执行的数据库操作 + migrations.AlterField( # gst: 执行“修改字段”的迁移操作 + model_name='comment', # gst: 要修改的模型名称(Comment) + name='is_enable', # gst: 要修改的字段名称(是否显示字段) + field=models.BooleanField(default=False, verbose_name='是否显示'), # gst: 修改后字段类型为布尔型,默认值改为False,后台显示名称为“是否显示” ), - ] + ] \ No newline at end of file