开发者

django admin page not showing same results as tutorial 2 from documentation. Why?

开发者 https://www.devze.com 2023-02-24 01:05 出处:网络
My code follows django\'s tutorial 2 on the admin page.I\'m just so confused why 开发者_高级运维I don\'t get two entries to put inside the admin Change Blog page.Anyone has an idea.

My code follows django's tutorial 2 on the admin page. I'm just so confused why 开发者_高级运维I don't get two entries to put inside the admin Change Blog page. Anyone has an idea.

from blogs.models import Blog,Entry
from django.contrib import admin

class EntryInline(admin.TabularInline):
    model = Entry
    extra = 3

class BlogAdmin(admin.ModelAdmin):
    fieldsets = [(None,{'fields': ['name']})]

    inlines = [EntryInline]

list_display=('tag_line')

admin.site.register(Blog, BlogAdmin)


Are these lines in an admin.py and your URLconf is setup correctly for autodiscovery of the ModelAdmins?

Does ommitting the fieldsets make a difference?

Make sure your model has a unicode-method, or try use list_display to represent you model in the changelist by list of selected fields. In your example list_display is not indented correctly:
Check the example for PersonAdmin in the docs:

class BlogAdmin(admin.ModelAdmin):
    list_display = ('post_title', 'post_author')
0

精彩评论

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