Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • Home
  • SEARCH
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 4105718
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 20, 20262026-05-20T21:17:01+00:00 2026-05-20T21:17:01+00:00

I asked some questions about Django inheritance in a previous question . Now I

  • 0

I asked some questions about Django inheritance in a previous question. Now I am trying to figure out how to get the admin interface to work with it.

If I had some models like this:

class ContentItem(models.Model):
    title = models.CharField(max_length=1000)
    page_order = models.IntegerField()
    last_update_date = models.DateTimeField(default=datetime.now())

    class Meta:
      abstract = True
      ordering = ['page_order', 'last_update_date', 'title']

class LinkContent(ContentItem):
  url = models.URLField()
  link_text = models.CharField(max_lenth=1000)

class TextContent(ContentItem):
 text = models.CharField()


class VideoContent(ContentItem):
      title = models.CharField()
      video_file = models.FieldField(upload_to = 'videos')

class Page(models.Model):
  contents = models.ManyToManyField(ContentItem)
  title = models.CharField()

Assume I am using django-model-utils as was mentioned in the previous question’s answer.

How would I make the admin interface show the correct inline based on the child class? I want the correct inline to show for the type. So if the I have 3 items in contents, some text, a link and a video. Then when I look at that Page in the admin interface, I want to see the inline form for each item.

How is this accomplished?

Also, how would I handle adding new things to the relation? Ideally, when the user wants to add a new ContentItem they would be asked what kind of content item they need to add. Then the add form for that content type would open in a pop up. So if I specify I want to add VideoContent, then I get a pop up that lets me upload the video. If I specify I want TextContent I get a pop up where I enter the text.

It seems like special consideration is needed for the change form for the Page model. Any suggestions on how to handle this issue?

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-05-20T21:17:02+00:00Added an answer on May 20, 2026 at 9:17 pm

    So it turns out that if you use django-model-utils and do the inheritance. Then you can add inlines for each of the sub classes. The Django admin will figure it out. It will show the right form for the class.

    Problem solved.

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

Note The question below was asked in 2008 about some code from 2003. As
I get asked this question a lot and I thought I'd solicit some input
I have already asked some questions about this topic, I have made some modifications
I had asked some questions about developing an online judge sometime ago on stackoverflow
I asked a question earlier which elicited some great responses. Here's the earlier question
This is a question I asked on another forum which received some decent answers,
(I asked this question in another way , and got some interesting responses but
My question is quite relevant to something asked before but I need some practical
We built a grant application system for a client. They've now asked for some
I've been into this problem for a while already, and have asked some questions

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.