views:

182

answers:

1

Consider a wiki application. There is a model Page, that has many Revisions and each revision has many blocks.

What is the simplest way to create an admin in which, you select a page and all the blocks of the latest revision appear; bonus points for letting change of revision by a dropdown (which is by default, sorted in reverse order anyway)

Is it absolutely necessary to create views, or can I extend some of those StackedInline forms, override save and mention some magic meta options, to get it all done automagically.

+1  A: 

Have you tried something like this (in admin.py):

class RevInline(admin.TabularInline):
    model = Revision

class PageAdmin(admin.ModelAdmin):
    model = Page
    inlines = (RevInline,)

admin.site.register(Page, PageAdmin)
Emil Ivanov
Yes, Something like this is what I have got. But I want blocks displayed. Each revision has many blocks associated with it. So, essentially, I select page, I need all the blocks associated with the latest revision of the page
Lakshman Prasad