115页 6.1.2 报错呢。。
from django.contrib import admin
from .models import Comment
@admin.register(Comment)
class CommentAdmin(admin.ModelAdmin):
list_display = ('traget','nickname','content','website','created_time')
按书上教程敲的代码。 到这里就报错了。。。
ERRORS: <class 'comment.admin.CommentAdmin'>: (admin.E108) The value of 'list_display[0]' refers to 'traget', which is not a callable, an attribute of 'CommentAdmin', or an attribute or method on 'comment.Comment'.
那个是target吧,不是traget。
Django的错误提示已经很明白了。
不光这个,还有书上代码。92页
target = models.ForeignKey(Post,verbose_name="评论目标") 好像也不对
应该是ForeignKey这个引用外键在django 2 这个版本改变了,具体的我忘记了,你可以看看作者github这里的代码