多应用+插件架构,代码干净,二开方便,首家独创一键云编译技术,文档视频完善,免费商用码云13.8K 广告
- 创建超级用户 - python manage.py createsuperuser - http://127.0.0.1:8000/admin/login/?next=/admin/ - 修改为中文settings.py >LANGUAGE_CODE = 'zh_Hans' - 注册模型 ~~~ # -*- coding: utf-8 -*- from django.contrib import admin from models import Arttcle class ArticleAdmin(admin.ModelAdmin): # 指定要显示的字段 list_display = ('id', 'title', 'content', 'pub_time') # 会在页面产生一个搜索框,搜索的字段为'title', 'content'字段,可以模糊匹配 search_fields = ('title', 'content') # 对id降序排列 ordering = ('-id',) # 过滤器 list_filter = ('pub_time',) # 可编辑的列 list_editable = ('title',) # 每页十条 list_per_page = 10 admin.site.register(Arttcle, ArticleAdmin) ~~~