激活Django自带的管理界面:

激活Django自带的管理界面:

python manage.py createsuperuser(必须含有django.contrib.auth)

问题:

django.urls.exceptions.NoReverseMatch: Reverse for 'logout' with no arguments not found. 1 pattern(s) tried: ['admin/$logout\\/$']

解决:

url(r'^admin/$',admin.site.urls),删除$就行了。

将models加入admin:

from django.contrib import admin
from books.models import Publisher,Author,Book
admin.site.register(Publisher)
admin.site.register(Author)

admin.site.register(Book)

自定义字段标签:用verbose_name

例子:

email = models.EmailField(verbose_name = 'e-mail')等同于

email = models.EmailField('e-mail',blank=Ture)


猜你喜欢

转载自blog.csdn.net/z13405546523/article/details/80038953
0条评论
添加一条新回复
  
今日推荐