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)