65 lines
3.0 KiB
Python
65 lines
3.0 KiB
Python
|
# Generated by Django 5.1.1 on 2024-09-17 09:19
|
||
|
|
||
|
import ckeditor_uploader.fields
|
||
|
import django.db.models.deletion
|
||
|
import django.utils.timezone
|
||
|
from django.conf import settings
|
||
|
from django.db import migrations, models
|
||
|
|
||
|
|
||
|
class Migration(migrations.Migration):
|
||
|
|
||
|
initial = True
|
||
|
|
||
|
dependencies = [
|
||
|
migrations.swappable_dependency(settings.AUTH_USER_MODEL),
|
||
|
]
|
||
|
|
||
|
operations = [
|
||
|
migrations.CreateModel(
|
||
|
name='ArticleTag',
|
||
|
fields=[
|
||
|
('id', models.AutoField(primary_key=True, serialize=False)),
|
||
|
('tag', models.CharField(max_length=500, verbose_name='标签')),
|
||
|
('user', models.ForeignKey(on_delete=django.db.models.deletion.CASCADE, to=settings.AUTH_USER_MODEL, verbose_name='用户')),
|
||
|
],
|
||
|
options={
|
||
|
'verbose_name': '博文分类',
|
||
|
'verbose_name_plural': '博文分类',
|
||
|
},
|
||
|
),
|
||
|
migrations.CreateModel(
|
||
|
name='ArticleInfo',
|
||
|
fields=[
|
||
|
('id', models.BigAutoField(auto_created=True, primary_key=True, serialize=False, verbose_name='ID')),
|
||
|
('title', models.CharField(max_length=200, verbose_name='标题')),
|
||
|
('content', ckeditor_uploader.fields.RichTextUploadingField(verbose_name='内容')),
|
||
|
('articlephoto', models.ImageField(blank=True, upload_to='images/article/', verbose_name='文章图片')),
|
||
|
('reading', models.IntegerField(default=0, verbose_name='阅读量')),
|
||
|
('liking', models.IntegerField(default=0, verbose_name='点赞量')),
|
||
|
('created', models.DateTimeField(default=django.utils.timezone.now, verbose_name='创建时间')),
|
||
|
('updated', models.DateTimeField(auto_now=True, verbose_name='更新时间')),
|
||
|
('author', models.ForeignKey(on_delete=django.db.models.deletion.CASCADE, to=settings.AUTH_USER_MODEL, verbose_name='用户')),
|
||
|
('article_tag', models.ManyToManyField(blank=True, to='article.articletag', verbose_name='文章标签')),
|
||
|
],
|
||
|
options={
|
||
|
'verbose_name': '博文管理',
|
||
|
'verbose_name_plural': '博文管理',
|
||
|
},
|
||
|
),
|
||
|
migrations.CreateModel(
|
||
|
name='Comment',
|
||
|
fields=[
|
||
|
('id', models.BigAutoField(auto_created=True, primary_key=True, serialize=False, verbose_name='ID')),
|
||
|
('commentator', models.CharField(max_length=90, verbose_name='评论用户')),
|
||
|
('content', models.TextField(verbose_name='评论内容')),
|
||
|
('created', models.DateTimeField(auto_now_add=True, verbose_name='创建时间')),
|
||
|
('article', models.ForeignKey(on_delete=django.db.models.deletion.CASCADE, to='article.articleinfo', verbose_name='所属文章')),
|
||
|
],
|
||
|
options={
|
||
|
'verbose_name': '评论管理',
|
||
|
'verbose_name_plural': '评论管理',
|
||
|
},
|
||
|
),
|
||
|
]
|