The dashboard atDocumentation Index
Fetch the complete documentation index at: https://mintlify.com/rahul-baberwal/django-var-cms/llms.txt
Use this file to discover all available pages before exploring further.
/var-cms/ is your team’s command center. It displays a card for every registered model that is configured to appear, showing a live record count, quick-action buttons, and a link to the full list view. By default all cards are hidden — you opt each one in explicitly so the dashboard shows only what matters.
Showing and Hiding Cards
Per-Model: dashboard_card Attribute
Set dashboard_card = True on any VarCMSModelAdmin subclass to show that model’s card on the dashboard. The default is False.
Global: settings.py Overrides
You can also control visibility globally from settings.py without touching each admin class.
index_view:
- If
VAR_CMS_SHOWN_DASHBOARD_CARDSis non-empty, a card is shown only if the model is listed there; all others are hidden regardless of theirdashboard_cardattribute. - If
VAR_CMS_HIDDEN_DASHBOARD_CARDScontains the model (checked bymodel_nameorapp_label.model_name), the card is always hidden — this overrides evenVAR_CMS_SHOWN_DASHBOARD_CARDS. - Otherwise, the card follows the
dashboard_cardattribute on the admin class.
Because
VAR_CMS_HIDDEN_DASHBOARD_CARDS is applied after VAR_CMS_SHOWN_DASHBOARD_CARDS, a model that appears in both lists will be hidden. Keep the lists mutually exclusive to avoid confusion.Dashboard Title and Welcome Text
Two settings control the heading and welcome copy shown at the top of the dashboard:VAR_CMS_DASHBOARD_TEXT value is rendered with Python’s str.format() at request time. Two placeholders are available:
| Placeholder | Value |
|---|---|
{username} | The current user’s username |
{user} | Same as {username} (alias) |
“Welcome back, . Your central command is active. Seamlessly manage database models, publish rich dynamic content, crop media assets, and orchestrate translation systems in real time.”
Custom Card Buttons (card_buttons)
Each dashboard card renders action buttons at the bottom. If you do not define card_buttons, the library generates default buttons based on the user’s permissions:
| Default button | Shown when |
|---|---|
| View List | User has list permission |
| Add New | User has add permission |
card_buttons to a list of dicts on the admin class. Each dict supports:
| Key | Type | Description |
|---|---|---|
label | string | Button text |
action | string | Built-in: "list" (goes to list view) or "add" (goes to add form). If set, url is resolved automatically. |
url | string | Any custom relative or absolute URL (used when action is not set). |
class | string | CSS class: "btn-primary", "btn-ghost", "btn-danger". |
Full Example: ArticleAdmin
Below is the completeArticleAdmin configuration from the demo app, which shows two card buttons and full role-based permissions:
Sidebar Navigation
The collapsible sidebar is built automatically from your registry — you do not configure it separately. For every registered model where the current user haslist permission, an entry is added to the nav grouped by app_label. The sidebar state (expanded or collapsed) is persisted to localStorage so it survives page reloads.