0

我想用 django 创建管理后端

模块/博客/admin.py

from django.contrib import admin
from .models import Post

# Register your models here.
admin.site.register(Post)

当我点击保存时,我除了添加新的博客文章内容

AttributeError at /admin/blog/post/add/
'Post' object has no attribute 'publish'
Request Method: POST
Request URL:    http://ilkblog.dev:8000/admin/blog/post/add/
Django Version: 1.11.7
Exception Type: AttributeError
Exception Value:    
'Post' object has no attribute 'publish'
Exception Location: /data/lib/python3.6/site-packages/django/db/models/base.py in _perform_date_checks, line 1146
Python Executable:  /data/bin/python
Python Version: 3.6.3
Python Path:    
['/app/app',
 '/data/lib/python36.zip',
 '/data/lib/python3.6',
 '/data/lib/python3.6/lib-dynload',
 '/data/lib/python3.6/site-packages']
Server time:    Fri, 1 Dec 2017 22:36:08 +0000
4

0 回答 0