开发者

Indention Error in django python code

开发者 https://www.devze.com 2023-03-23 19:12 出处:网络
I am getting an Indention Error. This code is straight from the django first tutorial. class开发者_如何学编程 ChoiceInline(admin.StackedInline):

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

精彩评论

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