Skip to main content

Getting started

The Table (list) view of an admin model can be highly customized using sbadmin_list_display. It builds on top of Django’s standard admin list view, while adding advanced formatting, styling, and control over how data is presented. This allows you to display custom fields or apply formatting to existing fields—without modifying the underlying model.

Key features:

  • Rename columns
  • Format values using Python functions (python_formatter)
  • Include related model data
  • Add badges, colors, or custom HTML
  • Exporting table to XLSX format
  • Advanced filtering
  • Saving filtered views
  • Performing bulk actions

💡Example: Defining the Table / List View

To customize the list view, you define sbadmin_list_display with selected fields in your admin class:

catalog/sb_admin.py
@admin.register(Product, site=sb_admin_site)
class ProductSBAdmin(SBAdmin):
model = Product
inlines = [ProductImageInline]
sbadmin_list_display = (
"name",
"sku",
SBAdminField(name="price", title=_("Price")),
SBAdminField(name="is_active", title=_("Active")),
"manufacturer",
)
list_per_page = 25 # Sets the number of items to display per page