Inlines
SmartBase Admin supports inlines in a powerful and flexible way using a set of custom classes extending Django’s built-in inline functionality.
Inlines allow related objects to be edited on the same page as the parent object. django-smartbase-admin enhances this with a polished UI,
sortable support and tabular/stacked rendering options out of the box.
Available Inline Classes
The following inline classes are available and can be used depending on your needs:
SBAdminTableInline
- Code
- Result
class ProductImageInline(SBAdminTableInline):
model = ProductImage
fields = ("image", "alt_text")
extra = 1

SBAdminStackedInline
- Code
- Result
class ProductImageInline(SBAdminStackedInline):
model = ProductImage
fields = ("image", "alt_text")
extra = 1

SBAdminStackedInlineBase (Collapsible Stacked Inline)
SBAdminStackedInline inherits from SBAdminStackedInlineBase, which adds a collapse/expand toggle for all inline rows. You can control whether inlines start collapsed by setting default_collapsed:
from django_smartbase_admin.admin.admin_base import SBAdminStackedInline
class ProductImageInline(SBAdminStackedInline):
model = ProductImage
fields = ("image", "alt_text")
extra = 1
default_collapsed = True # All inline rows start collapsed
| Attribute | Type | Default | Description |
|---|---|---|---|
default_collapsed | bool | False | If True, all stacked inline rows are collapsed by default. A "Collapse" toggle button is automatically added to the inline header. |
SBAdminTableInlinePaginated
For inlines with many related objects, use SBAdminTableInlinePaginated to enable server-side pagination:
from django_smartbase_admin.admin.admin_base import SBAdminTableInlinePaginated
class OrderItemInline(SBAdminTableInlinePaginated):
model = OrderItem
fields = ("product", "quantity", "price")
per_page = 50 # Number of inline rows per page (default: 50)
A generic variant SBAdminGenericTableInlinePaginated is also available for models using GenericForeignKey.
Manage related objects that use GenericForeignKey
SBAdminGenericTableInline and SBAdminGenericStackedInline are same as SBAdminTableInline and SBAdminStackedInline, but Generic inlines allow you to manage related objects that use GenericForeignKey.