djangoAdminApp

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)

  

djangoAdminApp

上一篇:android studio 打正式包注意事项


下一篇:苹果和安卓机的兼容问题