Indention Error in django python code
I am getting an Indention Error. This code is straight from the django first tutorial.
class开发者_如何学编程 ChoiceInline(admin.StackedInline):
model = Choice
extra = 3
class PollAdmin(admin.ModelAdmin):
fieldsets = [
(None, {'fields': ['question']}),
('Date information', {'fields': ['pub_date'], 'classes': ['collapse']}),
]
inlines = [ChoiceInline]
admin.site.register(Poll, PollAdmin)
Works fine for me on python2.7, make sure you didn't mix tabs and spaces in your actual code. There is also an extra comma at the end of the second line in fieldsets, but that should be fine in python.
精彩评论