From 196ed6920c2828b9487fc571d381f64712a9aefb Mon Sep 17 00:00:00 2001 From: crossdark Date: Fri, 20 Sep 2024 20:18:59 +0800 Subject: [PATCH] =?UTF-8?q?=E4=BF=AE=E6=94=B9=E4=BA=86article=E6=95=B0?= =?UTF-8?q?=E6=8D=AE=E5=BA=93?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- SinkDark/article/__init__.py | 5 ++++- SinkDark/article/admin.py | 2 -- SinkDark/article/models.py | 1 + 3 files changed, 5 insertions(+), 3 deletions(-) diff --git a/SinkDark/article/__init__.py b/SinkDark/article/__init__.py index eff9a8e..124607b 100644 --- a/SinkDark/article/__init__.py +++ b/SinkDark/article/__init__.py @@ -1,14 +1,17 @@ from django.apps import AppConfig import os + # 修改app在admin后台显示名称 # default_app_config的值来自apps.py的类名 default_app_config = 'article.IndexConfig' + # 获取当前app的命名 def get_current_app_name(_file): return os.path.split(os.path.dirname(_file))[-1] + # 重写类IndexConfig class IndexConfig(AppConfig): name = get_current_app_name(__file__) - verbose_name = '博客管理' \ No newline at end of file + verbose_name = '博客管理' diff --git a/SinkDark/article/admin.py b/SinkDark/article/admin.py index 1b7e6dc..baa99e2 100644 --- a/SinkDark/article/admin.py +++ b/SinkDark/article/admin.py @@ -46,8 +46,6 @@ class ArticleInfoAdmin(admin.ModelAdmin): return super().formfield_for_foreignkey(db_field, request, **kwargs) - - @admin.register(Comment) class CommentAdmin(admin.ModelAdmin): list_display = ['article', 'commentator', 'content', 'created'] diff --git a/SinkDark/article/models.py b/SinkDark/article/models.py index a4c5d7d..51b826d 100644 --- a/SinkDark/article/models.py +++ b/SinkDark/article/models.py @@ -21,6 +21,7 @@ class ArticleInfo(models.Model): author = models.ForeignKey(MyUser, on_delete=models.CASCADE, verbose_name='用户') title = models.CharField('标题', max_length=200) content = RichTextUploadingField(verbose_name='内容') + rendered = RichTextUploadingField(verbose_name='最终内容') articlephoto = models.ImageField('文章图片', blank=True, upload_to='images/article/') reading = models.IntegerField('阅读量', default=0) liking = models.IntegerField('点赞量', default=0)