You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Copy file name to clipboardExpand all lines: docs/detail/fake_inlines.mdx
+9-5Lines changed: 9 additions & 5 deletions
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -1,5 +1,5 @@
1
1
---
2
-
sidebar_position: 2
2
+
sidebar_position: 4
3
3
title: Fake Inlines
4
4
---
5
5
importTabsfrom'@theme/Tabs';
@@ -10,6 +10,10 @@ import TabItem from '@theme/TabItem';
10
10
SBAdminFakeInlineMixin is used to create inlines that are dynamically filtered — without needing a real ForeignKey relationship in the database. This is useful when you want to show related data based on some logic (e.g. "products from the same manufacturer") but don’t want to (or can't) define a hard model relation.
11
11
12
12
These inlines are rendered like standard inlines but do not impact database schema.
- Define inline which extending `SBAdminFakeInlineMixin`
15
19
- For inline, define `filter_fake_inline_identifier_by_parent_instance(self, inline_queryset, parent_instance)`. This controls what queryset will be shown in the inline, based on the parent instance.
@@ -21,11 +25,11 @@ This example showcases a fake inline for a Product admin page that lists other p
Copy file name to clipboardExpand all lines: docs/installation.md
+1Lines changed: 1 addition & 0 deletions
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -5,6 +5,7 @@ title: Quick start
5
5
# Getting Started
6
6
7
7
Smartbase Admin is a powerful extension for Django projects, providing a customizable admin interface. Follow the steps below to install and configure it in your project.
Copy file name to clipboardExpand all lines: docs/menu.mdx
+60-2Lines changed: 60 additions & 2 deletions
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -7,7 +7,7 @@ import TabItem from '@theme/TabItem';
7
7
# Menu
8
8
This section demonstrates how to define menu items using the SBAdminRoleConfiguration class.
9
9
10
-
###Defining Menu Items
10
+
## Defining Menu Items
11
11
To create a custom menu, define a list of SBAdminMenuItem instances and pass them to SBAdminRoleConfiguration.
12
12
13
13
```python title="sb_admin_configuration.py"
@@ -31,4 +31,62 @@ Each `SBAdminMenuItem` accepts the following key parameters:
31
31
-`view_id`: Unique identifier of the view this item links to.
32
32
-`icon` (optional): The icon name from [🔗 Available icons](https://github.com/SmartBase-SK/django-smartbase-admin/tree/main/src/django_smartbase_admin/static/sb_admin/sprites/sb_admin).
33
33
-`label` (optional): Overrides the default label.
34
-
-`sub_items` (optional): A list of nested SBAdminMenuItem objects, supporting menu nesting.
34
+
-`sub_items` (optional): A list of nested SBAdminMenuItem objects, supporting menu nesting.
35
+
36
+
## Role-Based Menu Configuration
37
+
You can define different menus for different user roles by extending SBAdminRoleConfiguration and using get_configuration_for_roles in your SBAdminConfiguration.
0 commit comments