Metadata-Version: 2.4
Name: django-admin-modern-view
Version: 0.2.1
Summary: A modern, keyboard-first UI layer for Django's built-in admin — command palette, global search, dashboard, and more, on top of your existing ModelAdmin config.
Author: Hitesh
License: MIT
Project-URL: Homepage, https://github.com/HItzz07/Django-adminkit
Project-URL: Repository, https://github.com/HItzz07/Django-adminkit
Project-URL: Issues, https://github.com/HItzz07/Django-adminkit/issues
Keywords: django,admin,ui,command-palette,dashboard
Classifier: Development Status :: 4 - Beta
Classifier: Environment :: Web Environment
Classifier: Framework :: Django
Classifier: Framework :: Django :: 5.1
Classifier: Framework :: Django :: 5.2
Classifier: Intended Audience :: Developers
Classifier: License :: OSI Approved :: MIT License
Classifier: Operating System :: OS Independent
Classifier: Programming Language :: Python :: 3
Classifier: Programming Language :: Python :: 3.10
Classifier: Programming Language :: Python :: 3.11
Classifier: Programming Language :: Python :: 3.12
Classifier: Topic :: Internet :: WWW/HTTP :: Dynamic Content
Classifier: Topic :: Software Development :: Libraries :: Python Modules
Requires-Python: >=3.10
Description-Content-Type: text/markdown
License-File: LICENSE
Requires-Dist: Django<6.0,>=5.1
Provides-Extra: dev
Requires-Dist: pytest>=7.4; extra == "dev"
Requires-Dist: pytest-django>=4.7; extra == "dev"
Dynamic: license-file

# django-admin-modern-view

A modern, keyboard-first UI layer for Django's built-in admin. Drop it into
`INSTALLED_APPS`, keep your existing `ModelAdmin` classes exactly as they
are, and the admin gets a command palette, global search, a real dashboard,
and a reskinned shell — without giving up anything Django's admin already
does for you (permissions, `list_filter`, inlines, actions, forms).

This is **not** a fork of `django.contrib.admin` and it does not replace it.
It ships two small template overrides (the shell + the dashboard) and pure
CSS/JS progressive enhancement on top of the admin's existing, stable DOM
(`#result_list`, `#changelist-filter`, `.submit-row`, `#nav-sidebar`, …).
Every page Django's admin can render, it can still render with this
installed — worst case you lose the extra chrome, you never lose function.

## Features

- **Command palette** (`Ctrl+K`) — fuzzy-search navigation and "create"
  commands, generated from your admin site's registered models, plus a
  `register_command()` API for anything custom.
- **Global search** — searches every `ModelAdmin` that already defines
  `search_fields` (zero config), permission-checked per model.
- **Keyboard shortcuts** — `Ctrl+S`/`Ctrl+Shift+S` save, `J`/`K`/`Enter`/
  `Space` to navigate and select change-list rows, `?` for a shortcut
  cheat sheet, `Esc` closes whatever overlay is open.
- **Enhanced change list** — sticky header, keyboard row navigation, and a
  dropdown "Filters" panel built from your existing `list_filter`.
- **Enhanced change form** — sticky save bar, dirty-state indicator,
  unsaved-changes warning before navigating away.
- **Dashboard** — per-model stat cards and collapsible per-app sections
  (with model counts) in place of the plain default app list.
- **Light/dark theme** — reskins Django's own built-in theme toggle; no
  separate dark-mode system to maintain.
- A system check that catches the #1 setup mistake (see below) instead of
  failing silently.

## Requirements

- Django 5.1 or newer (uses the admin's built-in dark-mode theme toggle and
  collapsible sidebar, both introduced in 5.1).
- Python 3.10+.

## Install

```bash
pip install django-admin-modern-view
```

Or, until it's published, install straight from GitHub:

```bash
pip install git+https://github.com/HItzz07/Django-adminkit.git
```

For local development against this repo:

```bash
pip install -e /path/to/django-admin-modern-view
```

## Quickstart

1. Add it to `INSTALLED_APPS`, **before** `django.contrib.admin` — Django's
   template loader resolves `admin/*.html` overrides by walking
   `INSTALLED_APPS` in order and using the first match:

   ```python
   INSTALLED_APPS = [
       "django_admin_modern_view",   # must come before django.contrib.admin

       "django.contrib.admin",
       "django.contrib.auth",
       "django.contrib.contenttypes",
       "django.contrib.sessions",
       "django.contrib.messages",
       "django.contrib.staticfiles",

       # your apps...
   ]
   ```

2. Wire its URLs in front of the admin's own (it only adds two small JSON
   endpoints under `admin/`, both `staff_member_required`):

   ```python
   from django.contrib import admin
   from django.urls import include, path

   urlpatterns = [
       path("admin/", include("django_admin_modern_view.urls")),
       path("admin/", admin.site.urls),
   ]
   ```

3. Run the server. That's it — no changes to your `ModelAdmin` classes are
   required. If something looks unstyled, run `python manage.py check`;
   the bundled system check (`django_admin_modern_view.W001`) will tell you if the
   `INSTALLED_APPS` order is the problem.

## Configuration

### Custom command palette entries

```python
# anywhere that runs at import time, e.g. your app's apps.py ready()
from django_admin_modern_view.services.command_registry import register_command

register_command(
    id="reindex_search",
    label="Rebuild search index",
    category="Actions",
    url="/admin/tools/reindex/",
    icon="refresh",
)
```

### Custom global search sources

Any `ModelAdmin` with `search_fields` is picked up automatically. To search
a model that isn't registered with the admin, or to use different fields
than the admin search box does:

```python
from django_admin_modern_view.services.search import register_global_search
from myapp.models import Order

register_global_search(Order, fields=["reference", "customer__email"], label="Orders")
```

`search_fields` prefixes work the same way they do for `ModelAdmin`:
`^field` (starts-with), `=field` (exact), `@field` (full-text), plain
`field` (contains).

## How it stays compatible

This package only overrides two templates: `admin/base_site.html` (the
shell every admin page extends) and `admin/index.html` (the dashboard).
Change lists, change forms, inlines, filters, and actions are all still
Django's own templates — this package only attaches CSS and progressive-
enhancement JS to their existing, stable element IDs. That means:

- Every `ModelAdmin` option (`list_display`, `list_filter`, `search_fields`,
  `fieldsets`, `inlines`, `actions`, permissions) keeps working exactly as
  configured.
- The admin still works with JavaScript disabled — the extra chrome (command
  palette, dirty-state indicator, keyboard nav) is progressive enhancement,
  not a requirement.
- No monkey-patching of `django.contrib.admin` internals.

## Development

```bash
pip install -e ".[dev]"
pytest
```

## License

MIT — see [LICENSE](LICENSE).
