Skip to main content

Filters and Saved Views

Just like Django’s list_filter, SmartBase supports adding filters based on model fields, including related fields. Filters are automatically displayed in the UI, and you can stack multiple filters together to narrow down your data.

Filters sbadmin

Saved Views

A powerful upgrade that SmartBase Admin allows users to save filtered views with their preferred column layout, filters, and sorting. This is helpful when working with large datasets or recurring workflows.

For example, administrator can save a view for only Active products

These saved views are accessible from the UI and persist across sessions, making the admin panel more user-friendly and workflow-driven.

💡Usage example

Apply your preffered filters using the sidebar or column filters. Click the “Save View” button in the top-right corner of the list view interface. Saved view sbadmin

A dialog will appear prompting you to enter a name for the view.

Saved view sbadmin

Once saved, the view will appear in the list of available views, allowing you to easily switch between different filter and display configurations.

Saved view sbadmin

Predefined filtered views

SmartBase Admin allows you to define custom filtered views directly in your admin class using the sbadmin_list_view_config attribute. These views are especially useful for frequently used filter combinations, allowing quick access from the UI.

💡Usage example

Here's an example of how to define a predefined view that shows only inactive products:

catalog/sb_admin.py
@admin.register(Product, site=sb_admin_site)
class ProductSBAdmin(SBAdmin):
...
sbadmin_list_view_config = [
{
"name": _("Inactive"),
"url_params": {
"filterData": {"is_active": False}
},
}
]
...