开发者

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.

0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜