后台数据库显示对应app下的admin.pyfrom django.contrib import admin from article_app.models import Article # 引入数据模型引入APP的文章数据库但是要具体定制就不用在这引入#admin.site.register(Article)后台登录进去的标题admin.site.site_header 三门峡市统计信息局网站后台管理修改后台登录的文字admin.site.site_title 三门峡市统计信息局声明你想定制的表admin.register(Article) class ArticleAdmin(admin.ModelAdmin): # 设置要显示在列表中的字段id字段是Django模型的默认主键 list_display (title, author, time, views, source, sort) # 设置每页显示多少条记录默认是100条 list_per_page 12 # 设置默认排序字段负号表示降序排序 # ordering (-name,) # 操作项功能显示位置设置两个都为True则顶部和底部都显示 actions_on_top True actions_on_bottom True # 操作项功能显示选中项的数目 actions_selection_counter True # 字段为空值显示的内容 empty_value_display -无字段- # 设置默认可编辑字段name默认不可编辑因为它是一个链接点击会进入修改页面 # list_editable [TEL, member_type,] # fk_fields 设置显示外键字段 # fk_fields (member_type,) # 过滤器功能及能过滤的字段 list_filter (title, author) # 搜索功能及能实现搜索的字段 search_fields (id, title, author, sort) 后台app名字显示 #对应APP下的__init__ from django.apps import AppConfig import os#修改对应的‘article_app.ArticleAppConfig’这个名字与apps.py下的函数名字保持一致与下面的类的名字也是一致default_app_config article_app.ArticleAppConfig def get_current_app_name(_file): return os.path.split(os.path.dirname(_file))[-1] class ArticleAppConfig(AppConfig): name get_current_app_name(__file__) verbose_name 文章管理后台显示表名class Meta: db_table Opinion # 存进数据库里的表名 verbose_name_plural 意见 # 后台显示的表名
django定制后台
后台数据库显示对应app下的admin.pyfrom django.contrib import admin from article_app.models import Article # 引入数据模型引入APP的文章数据库但是要具体定制就不用在这引入#admin.site.register(Article)后台登录进去的标题admin.site.site_header 三门峡市统计信息局网站后台管理修改后台登录的文字admin.site.site_title 三门峡市统计信息局声明你想定制的表admin.register(Article) class ArticleAdmin(admin.ModelAdmin): # 设置要显示在列表中的字段id字段是Django模型的默认主键 list_display (title, author, time, views, source, sort) # 设置每页显示多少条记录默认是100条 list_per_page 12 # 设置默认排序字段负号表示降序排序 # ordering (-name,) # 操作项功能显示位置设置两个都为True则顶部和底部都显示 actions_on_top True actions_on_bottom True # 操作项功能显示选中项的数目 actions_selection_counter True # 字段为空值显示的内容 empty_value_display -无字段- # 设置默认可编辑字段name默认不可编辑因为它是一个链接点击会进入修改页面 # list_editable [TEL, member_type,] # fk_fields 设置显示外键字段 # fk_fields (member_type,) # 过滤器功能及能过滤的字段 list_filter (title, author) # 搜索功能及能实现搜索的字段 search_fields (id, title, author, sort) 后台app名字显示 #对应APP下的__init__ from django.apps import AppConfig import os#修改对应的‘article_app.ArticleAppConfig’这个名字与apps.py下的函数名字保持一致与下面的类的名字也是一致default_app_config article_app.ArticleAppConfig def get_current_app_name(_file): return os.path.split(os.path.dirname(_file))[-1] class ArticleAppConfig(AppConfig): name get_current_app_name(__file__) verbose_name 文章管理后台显示表名class Meta: db_table Opinion # 存进数据库里的表名 verbose_name_plural 意见 # 后台显示的表名