Take the 2-minute tour ×
class BasePost(models.Model):
    title = models.CharField(max_length=300)
    prompt = HTMLField()
    assets = MultiFileField(upload_to="assets/%Y/%m", blank=True)

class Activity(OrderedModel):
    prompt = models.ForeignKey(BasePost, related_name="prompts+")
    feature1 = models.ForeignKey(BasePost, related_name="feature+")
    feature2 = models.ForeignKey(BasePost, related_name="feature1+")

class BasePostInline(admin.TabularInline):
    model = BasePost

class ActivityAdmin(admin.ModelAdmin):
    inlines = [ BasePostInline, ]

admin.site.register(Activity, ActivityAdmin)

Essentially: Prompt, feature1, feature2 are all objects of type BasePost. BasePost has title, content, assets.

In the admin for Activity I can't figure out how to get title, content and asset fields to show up for each. Instead I'm just seeing dropdowns to select existing "BasePosts".

I tried using inlines but just couldnt figure it out.

share|improve this question

1 Answer 1

You have everything set backwards - You register your base class and set the Activity class as it's inline. Try this:

class ActivityInline(admin.TabularInline):
    model = Activity

class BasePostAdmin(admin.ModelAdmin):
    inlines = [ ActivityInline, ]

admin.site.register(BasePost, BasePostAdmin)


Duplicate of this question then:

share|improve this answer
I want the opposite though. So that an activity has a prompt, feature1, feature2 all of the format of (title, content, assets) Essentially, I'm trying to find a shortcut for this: [link]pastebin.com/HVWuy9Kz So that I don't need to create custom template code for each prompt, feature1, feature2 which are all identical in structure, just named differently. –  jeremylach Sep 9 '13 at 16:40

Your Answer


