# djangoadminhackers/django-admin-row-actions architecture

> Architecture diagram of the GitHub repository djangoadminhackers/django-admin-row-actions, generated by GitDiagram from its file tree, README and a sample of source files (last updated 2026-06-22). It is an AI-made overview: check details against the source.

- Interactive diagram: https://gitdiagram.com/djangoadminhackers/django-admin-row-actions
- Repository: https://github.com/djangoadminhackers/django-admin-row-actions

## Overview

1. **What this repo is**
   - A reusable **Django app/package** that adds a per-row “actions” dropdown to the Django admin changelist.
   - Its architecture is centered on extending `ModelAdmin`, not replacing the admin.

2. **Primary integration boundary**
   - The key extension point is the **`AdminRowActionsMixin`** exposed from `django_admin_row_actions`.
   - An application’s `ModelAdmin` subclasses this mixin and implements `get_row_actions(obj)` to describe the menu items for each row.

3. **Server-side action definition**
   - Row actions are built on the backend as per-object metadata: label, URL, enabled/disabled state, tooltip, divider, or named callable action.
   - The package’s job is to normalize those action definitions into something the admin template can render consistently.

4. **Rendering pipeline**
   - The dropdown is appended as the **last column in the changelist table**.
   - A Django template in `templates/django_admin_row_actions/dropdown.html` renders the per-row menu markup from the action data produced by the admin mixin/component layer.

5. **UI behavior layer**
   - Frontend behavior is handled by a standalone **jQuery dropdown script** in `static/js/jquery.dropdown.js`.
   - This is the client-side boundary that opens/closes the menu and makes the row action UI behave like a dropdown rather than a plain list of links.

6. **Action execution path**
   - Actions can be simple links, but the package also supports a named **`action` callable** on the `ModelAdmin` or the model.
   - That implies an internal dispatch path in the package’s server layer for invoking these named actions on the correct object, separate from ordinary URL navigation.

7. **Internal support modules**
   - `components.py`, `utils.py`, and `views.py` provide the supporting logic around formatting actions, resolving targets, and serving any admin-specific endpoints.
   - These modules form the “glue” between Django admin objects, templates, and the client-side dropdown.

8. **Internationalization**
   - The `locale/` directory shows the package is translated, with at least Russian and Traditional Chinese resources.
   - This matters for architecture because user-facing labels/tooltips are intended to be locale-aware inside the admin UI.

9. **Packaging and deployment shape**
   - `pyproject.toml`, `MANIFEST.in`, and the package layout indicate this is a **distributable library**, not an application.
   - Static assets, templates, and translation files are bundled so consuming projects only need to add the app to `INSTALLED_APPS`.

10. **External dependencies and runtime context**
   - The solution runs inside **Django’s admin runtime** and depends on **jQuery** for dropdown behavior.
   - Its external surface area is therefore the Django admin changelist, plus any user-defined URLs/actions referenced by `get_row_actions()`.

11. **Data flow summary**
   - `ModelAdmin.get_row_actions(obj)` → package normalizes actions → template renders menu HTML in changelist row → jQuery dropdown activates UI → optional server-side callable/URL is invoked when the user clicks an item.

Main entry points: [`django_admin_row_actions/admin.py`](https://github.com/djangoadminhackers/django-admin-row-actions/blob/master/django_admin_row_actions/admin.py) (Admin mixin), [`django_admin_row_actions/views.py`](https://github.com/djangoadminhackers/django-admin-row-actions/blob/master/django_admin_row_actions/views.py) (Action dispatch), [`django_admin_row_actions/components.py`](https://github.com/djangoadminhackers/django-admin-row-actions/blob/master/django_admin_row_actions/components.py) (Action model), [`MANIFEST.in`](https://github.com/djangoadminhackers/django-admin-row-actions/blob/master/MANIFEST.in) (Bundle rules)

## Diagram (Mermaid)

```mermaid
flowchart TD

subgraph group_pkg["Django package"]
  node_entry["Package API<br/>[__init__.py]"]
  node_admin_mixin["Admin mixin<br/>[admin.py]"]
  node_row_actions["Action model<br/>[components.py]"]
  node_helpers["Utilities<br/>helpers<br/>[utils.py]"]
  node_admin_views["Admin views<br/>[views.py]"]
  node_changelist{{"Changelist column<br/>integration<br/>[admin.py]"}}
  node_get_actions(("get_row_actions<br/>hook<br/>[admin.py]"))
  node_action_call{{"Action dispatch<br/>runtime flow<br/>[views.py]"}}
end

subgraph group_ui["Rendered UI"]
  node_dropdown_tpl["Dropdown template<br/>[dropdown.html]"]
  node_dropdown_js["Dropdown script<br/>client script<br/>[jquery.dropdown.js]"]
  node_assets["Static assets<br/>frontend assets"]
end

subgraph group_i18n["Translations"]
  node_locale_root[("Locales<br/>translations")]
  node_ru_locale["Russian<br/>translation<br/>[django.po]"]
  node_zh_locale["Chinese<br/>translation<br/>[django.po]"]
end

subgraph group_dist["Distribution"]
  node_manifest["Package metadata<br/>packaging<br/>[pyproject.toml]"]
  node_bundle["Bundle rules<br/>packaging<br/>[MANIFEST.in]"]
end

node_entry -->|"exports"| node_admin_mixin
node_admin_mixin -->|"calls"| node_get_actions
node_get_actions -->|"defines"| node_row_actions
node_admin_mixin -->|"extends"| node_changelist
node_changelist -->|"renders"| node_dropdown_tpl
node_row_actions -->|"context"| node_dropdown_tpl
node_dropdown_tpl -->|"activates"| node_dropdown_js
node_dropdown_js -->|"included in"| node_assets
node_admin_mixin -->|"uses"| node_helpers
node_helpers -->|"supports"| node_row_actions
node_admin_views -->|"dispatches"| node_action_call
node_action_call -->|"resolves via"| node_helpers
node_action_call -->|"invokes"| node_admin_mixin
node_action_call -->|"consumes"| node_row_actions
node_locale_root -->|"contains"| node_ru_locale
node_locale_root -->|"contains"| node_zh_locale
node_manifest -->|"includes"| node_bundle
node_bundle -->|"ships"| node_assets
node_bundle -->|"ships"| node_locale_root

click node_entry "https://github.com/djangoadminhackers/django-admin-row-actions/blob/master/django_admin_row_actions/__init__.py"
click node_admin_mixin "https://github.com/djangoadminhackers/django-admin-row-actions/blob/master/django_admin_row_actions/admin.py"
click node_row_actions "https://github.com/djangoadminhackers/django-admin-row-actions/blob/master/django_admin_row_actions/components.py"
click node_helpers "https://github.com/djangoadminhackers/django-admin-row-actions/blob/master/django_admin_row_actions/utils.py"
click node_admin_views "https://github.com/djangoadminhackers/django-admin-row-actions/blob/master/django_admin_row_actions/views.py"
click node_changelist "https://github.com/djangoadminhackers/django-admin-row-actions/blob/master/django_admin_row_actions/admin.py"
click node_get_actions "https://github.com/djangoadminhackers/django-admin-row-actions/blob/master/django_admin_row_actions/admin.py"
click node_action_call "https://github.com/djangoadminhackers/django-admin-row-actions/blob/master/django_admin_row_actions/views.py"
click node_dropdown_tpl "https://github.com/djangoadminhackers/django-admin-row-actions/blob/master/django_admin_row_actions/templates/django_admin_row_actions/dropdown.html"
click node_dropdown_js "https://github.com/djangoadminhackers/django-admin-row-actions/blob/master/django_admin_row_actions/static/js/jquery.dropdown.js"
click node_assets "https://github.com/djangoadminhackers/django-admin-row-actions/tree/master/django_admin_row_actions/static"
click node_locale_root "https://github.com/djangoadminhackers/django-admin-row-actions/tree/master/django_admin_row_actions/locale"
click node_ru_locale "https://github.com/djangoadminhackers/django-admin-row-actions/blob/master/django_admin_row_actions/locale/ru_RU/LC_MESSAGES/django.po"
click node_zh_locale "https://github.com/djangoadminhackers/django-admin-row-actions/blob/master/django_admin_row_actions/locale/zh_Hant/LC_MESSAGES/django.po"
click node_manifest "https://github.com/djangoadminhackers/django-admin-row-actions/blob/master/pyproject.toml"
click node_bundle "https://github.com/djangoadminhackers/django-admin-row-actions/blob/master/MANIFEST.in"

classDef toneNeutral fill:#f8fafc,stroke:#334155,stroke-width:1.5px,color:#0f172a
classDef toneBlue fill:#dbeafe,stroke:#2563eb,stroke-width:1.5px,color:#172554
classDef toneAmber fill:#fef3c7,stroke:#d97706,stroke-width:1.5px,color:#78350f
classDef toneMint fill:#dcfce7,stroke:#16a34a,stroke-width:1.5px,color:#14532d
classDef toneRose fill:#ffe4e6,stroke:#e11d48,stroke-width:1.5px,color:#881337
classDef toneIndigo fill:#e0e7ff,stroke:#4f46e5,stroke-width:1.5px,color:#312e81
classDef toneTeal fill:#ccfbf1,stroke:#0f766e,stroke-width:1.5px,color:#134e4a
class node_entry,node_admin_mixin,node_row_actions,node_helpers,node_admin_views,node_changelist,node_get_actions,node_action_call toneBlue
class node_dropdown_tpl,node_dropdown_js,node_assets toneAmber
class node_locale_root,node_ru_locale,node_zh_locale toneMint
class node_manifest,node_bundle toneRose
```

## Components

### Django package

Core Python modules that extend Django admin and coordinate row actions.

- [Package API](https://github.com/djangoadminhackers/django-admin-row-actions/blob/master/django_admin_row_actions/__init__.py): module · Public package entry point for the reusable admin extension. · `django_admin_row_actions/__init__.py`
- [Admin mixin](https://github.com/djangoadminhackers/django-admin-row-actions/blob/master/django_admin_row_actions/admin.py): mixin · Extends ModelAdmin with row-action support and changelist integration. · `django_admin_row_actions/admin.py`
- [Action model](https://github.com/djangoadminhackers/django-admin-row-actions/blob/master/django_admin_row_actions/components.py): Normalizes per-object action metadata such as labels, URLs, state, and callables. · `django_admin_row_actions/components.py`
- [Utilities](https://github.com/djangoadminhackers/django-admin-row-actions/blob/master/django_admin_row_actions/utils.py): helpers · Shared helpers for resolving objects, formatting actions, and related glue logic. · `django_admin_row_actions/utils.py`
- [Admin views](https://github.com/djangoadminhackers/django-admin-row-actions/blob/master/django_admin_row_actions/views.py): views · Server-side endpoints supporting action execution or admin-specific dispatch. · `django_admin_row_actions/views.py`
- [Changelist column](https://github.com/djangoadminhackers/django-admin-row-actions/blob/master/django_admin_row_actions/admin.py): integration · Injects the actions dropdown as the last column in the admin table. · `django_admin_row_actions/admin.py`
- [get_row_actions](https://github.com/djangoadminhackers/django-admin-row-actions/blob/master/django_admin_row_actions/admin.py): hook · Per-object hook implemented by consuming ModelAdmin classes to define row actions. · `django_admin_row_actions/admin.py`
- [Action dispatch](https://github.com/djangoadminhackers/django-admin-row-actions/blob/master/django_admin_row_actions/views.py): runtime flow · Resolves named actions on the ModelAdmin or model and invokes the correct handler. · `django_admin_row_actions/views.py`

### Rendered UI

Template and client-side behavior for the changelist dropdown.

- [Dropdown template](https://github.com/djangoadminhackers/django-admin-row-actions/blob/master/django_admin_row_actions/templates/django_admin_row_actions/dropdown.html): template · Renders the per-row menu markup from normalized action data. · `django_admin_row_actions/templates/django_admin_row_actions/dropdown.html`
- [Dropdown script](https://github.com/djangoadminhackers/django-admin-row-actions/blob/master/django_admin_row_actions/static/js/jquery.dropdown.js): client script · jQuery behavior for opening, closing, and interacting with the row dropdown. · `django_admin_row_actions/static/js/jquery.dropdown.js`
- [Static assets](https://github.com/djangoadminhackers/django-admin-row-actions/tree/master/django_admin_row_actions/static): frontend assets · Bundled client-side resources used by the admin row actions UI. · `django_admin_row_actions/static`

### Translations

Localized user-facing strings bundled with the package.

- [Locales](https://github.com/djangoadminhackers/django-admin-row-actions/tree/master/django_admin_row_actions/locale): translations · Bundled translations for user-facing labels and tooltips. · `django_admin_row_actions/locale`
- [Russian](https://github.com/djangoadminhackers/django-admin-row-actions/blob/master/django_admin_row_actions/locale/ru_RU/LC_MESSAGES/django.po): translation · Russian message catalog for admin row-action strings. · `django_admin_row_actions/locale/ru_RU/LC_MESSAGES/django.po`
- [Chinese](https://github.com/djangoadminhackers/django-admin-row-actions/blob/master/django_admin_row_actions/locale/zh_Hant/LC_MESSAGES/django.po): translation · Traditional Chinese message catalogs for admin row-action strings. · `django_admin_row_actions/locale/zh_Hant/LC_MESSAGES/django.po`

### Distribution

Packaging files that make the app installable and bundle assets.

- [Package metadata](https://github.com/djangoadminhackers/django-admin-row-actions/blob/master/pyproject.toml): packaging · Build configuration and manifest data for distributing the reusable Django app. · `pyproject.toml`
- [Bundle rules](https://github.com/djangoadminhackers/django-admin-row-actions/blob/master/MANIFEST.in): packaging · Includes templates, static files, and translations in source distributions. · `MANIFEST.in`

## Connections

- Package API → Admin mixin: exports · Public package surface exposes the admin mixin.
- Admin mixin → get_row_actions: calls · ModelAdmin subclasses provide per-object row actions through this hook.
- get_row_actions → Action model: defines · Hook output is normalized into action metadata objects.
- Admin mixin → Changelist column: extends · Adds the dropdown as the final changelist column.
- Changelist column → Dropdown template: renders · Template emits the per-row menu markup.
- Action model → Dropdown template: context · Normalized action data is passed into the template.
- Dropdown template → Dropdown script: activates · Rendered markup is wired up by the jQuery dropdown behavior.
- Dropdown script → Static assets: included in · The script ships as part of bundled static assets.
- Admin mixin → Utilities: uses · Mixin relies on helper logic for resolution and formatting.
- Utilities → Action model: supports · Helpers assist with shaping and resolving action definitions.
- Admin views → Action dispatch: dispatches · Views provide the server-side action invocation path.
- Action dispatch → Utilities: resolves via · Dispatch logic uses helpers to find the target object or callable.
- Action dispatch → Admin mixin: invokes · Named actions may live on the ModelAdmin extension.
- Action dispatch → Action model: consumes · Dispatch is driven by action metadata emitted by the package.
- Locales → Russian: contains · Russian translations are bundled under locale resources.
- Locales → Chinese: contains · Traditional Chinese translations are bundled under locale resources.
- Package metadata → Bundle rules: includes · Packaging configuration ensures assets and translations are shipped.
- Bundle rules → Static assets: ships · Static files are included in distributable artifacts.
- Bundle rules → Locales: ships · Translation catalogs are included in distributable artifacts.
