1 app向admin注册
from django.db import models from django.contrib import admin # Create your models here. class BlogPost(models.Model): title = models.CharField(max_length=150) body = models.TextField() timestamp = models.DateTimeField() #用于显示信息 class BlogPostAdmin(admin.ModelAdmin): list_display = (‘title‘,‘timestamp‘) #将表结构类和显示类注册到admin admin.site.register(BlogPost,BlogPostAdmin)