要在/bin/mysite/books/下建立一个admin.py,否则在admin页面显示不出内容如下:
from django.contrib import admin from models import Book, Author, Publisher admin.site.register(Book) admin.site.register(Publisher) admin.site.register(Author)
authors = models.ManyToManyField(Author)
publisher = models.ForeignKey(Publisher)
email = models.EmailField(blank=True) 设置这个字段为可选.
django 指令 基于the django book,布布扣,bubuko.com
原文:http://www.cnblogs.com/ZhangxLong/p/3891067.html