Display child strings in Django admin interface

Can I display child strings associated with a model using the Django admin interface? Model Example:

def Parent(models.Model): name = models.TextField() .... def Child(models.Model): name = models.TextField() Parent = models.ForeignKey(Parent) ... 

When viewing a specific parent, the following may be displayed in the admin interface:

 Name: Jack Children: Bob Jenny Sam .... 

I understand that I can distribute administrative views manually, just wondering if there is any magic that I can add to the admin.py file instead :)

+7
source share
1 answer

You can add children to the line .

 class ChildInline(admin.TabularInline): model = Child class ParentAdmin(admin.ModelAdmin): inlines = [ ChildInline, ] 
+18
source

All Articles