當我按照Django教程,當我添加一個list_display時,出現錯誤。有人可以弄清楚嗎?django教程民意調查錯誤list_display
from django.contrib import admin
from polls.models import Poll
from polls.models import Choice
class ChoiceInline(admin.TabularInline):
model = Choice
extra = 3
class PollAdmin(admin.ModelAdmin):
fieldsets = [
(None, {'fields': ['question']}),
('Date information', {'fields': ['pub_date'], 'classes': ['collapse']}),
]
list_display = ('question', 'pub_date')
inlines = [ChoiceInline]
admin.site.register(Poll, PollAdmin)
admin.site.register(Choice)
似乎縮進錯誤。是嗎 ? –
異常類型:\t IndentationError 異常值:\t 意外縮進(admin.py,第14行) – Eriks
實現類PollAdmin(admin.ModelAdmin)的未正確indentated。 http://docs.python.org/release/2.5.1/ref/indentation.html –