修改了article数据库
This commit is contained in:
parent
688716e325
commit
196ed6920c
@ -1,14 +1,17 @@
|
|||||||
from django.apps import AppConfig
|
from django.apps import AppConfig
|
||||||
import os
|
import os
|
||||||
|
|
||||||
# 修改app在admin后台显示名称
|
# 修改app在admin后台显示名称
|
||||||
# default_app_config的值来自apps.py的类名
|
# default_app_config的值来自apps.py的类名
|
||||||
default_app_config = 'article.IndexConfig'
|
default_app_config = 'article.IndexConfig'
|
||||||
|
|
||||||
|
|
||||||
# 获取当前app的命名
|
# 获取当前app的命名
|
||||||
def get_current_app_name(_file):
|
def get_current_app_name(_file):
|
||||||
return os.path.split(os.path.dirname(_file))[-1]
|
return os.path.split(os.path.dirname(_file))[-1]
|
||||||
|
|
||||||
|
|
||||||
# 重写类IndexConfig
|
# 重写类IndexConfig
|
||||||
class IndexConfig(AppConfig):
|
class IndexConfig(AppConfig):
|
||||||
name = get_current_app_name(__file__)
|
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)
|
return super().formfield_for_foreignkey(db_field, request, **kwargs)
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
@admin.register(Comment)
|
@admin.register(Comment)
|
||||||
class CommentAdmin(admin.ModelAdmin):
|
class CommentAdmin(admin.ModelAdmin):
|
||||||
list_display = ['article', 'commentator', 'content', 'created']
|
list_display = ['article', 'commentator', 'content', 'created']
|
||||||
|
@ -21,6 +21,7 @@ class ArticleInfo(models.Model):
|
|||||||
author = models.ForeignKey(MyUser, on_delete=models.CASCADE, verbose_name='用户')
|
author = models.ForeignKey(MyUser, on_delete=models.CASCADE, verbose_name='用户')
|
||||||
title = models.CharField('标题', max_length=200)
|
title = models.CharField('标题', max_length=200)
|
||||||
content = RichTextUploadingField(verbose_name='内容')
|
content = RichTextUploadingField(verbose_name='内容')
|
||||||
|
rendered = RichTextUploadingField(verbose_name='最终内容')
|
||||||
articlephoto = models.ImageField('文章图片', blank=True, upload_to='images/article/')
|
articlephoto = models.ImageField('文章图片', blank=True, upload_to='images/article/')
|
||||||
reading = models.IntegerField('阅读量', default=0)
|
reading = models.IntegerField('阅读量', default=0)
|
||||||
liking = models.IntegerField('点赞量', default=0)
|
liking = models.IntegerField('点赞量', default=0)
|
||||||
|
Loading…
Reference in New Issue
Block a user