修改了article数据库
This commit is contained in:
parent
688716e325
commit
196ed6920c
@ -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 = '博客管理'
|
||||
verbose_name = '博客管理'
|
||||
|
@ -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']
|
||||
|
@ -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)
|
||||
|
Loading…
Reference in New Issue
Block a user