Metadata-Version: 2.4
Name: patera-admin
Version: 0.13.3
Summary: Admin dashboard for Patera applications: logs, databases, files, e-mail and task managers
Keywords: patera,admin,dashboard
Author: Marko Šterk
Author-email: Marko Šterk <marko_sterk@hotmail.com>
License-Expression: MIT
License-File: LICENSE
Classifier: Development Status :: 4 - Beta
Classifier: Framework :: AsyncIO
Classifier: Intended Audience :: Developers
Classifier: Operating System :: OS Independent
Classifier: Programming Language :: Python :: 3
Classifier: Programming Language :: Python :: 3 :: Only
Classifier: Programming Language :: Python :: 3.13
Classifier: Programming Language :: Python :: 3.14
Classifier: Typing :: Typed
Classifier: Topic :: Internet :: WWW/HTTP :: Dynamic Content
Requires-Dist: patera>=0.121
Requires-Dist: patera-auth>=0.11
Requires-Dist: markupsafe>=3.0
Requires-Python: >=3.13
Project-URL: Homepage, https://github.com/MarkoSterk/Patera
Project-URL: Documentation, https://github.com/MarkoSterk/Patera#readme
Project-URL: Repository, https://github.com/MarkoSterk/Patera
Project-URL: Issues, https://github.com/MarkoSterk/Patera/issues
Project-URL: Changelog, https://github.com/MarkoSterk/Patera/blob/main/CHANGELOG.md
Description-Content-Type: text/markdown

# patera-admin

Admin dashboard for Patera applications: request statistics, logs, databases, files, e-mail and task managers. Part of [Patera](https://github.com/MarkoSterk/Patera), a modular async-first Python web framework.

## Installation

```sh
pip install patera-admin
# or, with uv
uv add "patera[admin]"
```

Requires Python 3.13 or newer and `patera>=0.121`.

## Usage

`patera-admin` provides a web dashboard for request statistics, logs, database models, files in the
static folder, task managers and e-mail clients. It requires an [authentication](https://github.com/MarkoSterk/Patera#authentication) middleware: users need
the roles from `patera.admin.Permissions` (`ADMIN_CAN_ENTER` plus
`ADMIN_CAN_VIEW`/`CREATE`/`EDIT`/`DELETE`).

```python
from patera.admin import AdminConfig, AdminInterface


class Admin(AdminInterface):
    managed_models = [Note]


class Config(BaseConfig):
    ...
    ADMIN: AdminConfig = AdminConfig(
        URL_FOR_FOR_LOGIN="AuthApi.login", URL_FOR_FOR_LOGOUT="AuthApi.logout",
    )
```

The dashboard opens with the application's request statistics for the last 15 minutes, hour, 6 hours
or 24 hours: uptime, requests per second by status class, 2xx/4xx/5xx counts, average and
95th-percentile response times, the busiest endpoints and the most frequent error statuses. Admin
counts requests in memory, so each worker process shows its own requests since it started. Set
`REQUEST_STATISTICS=False` in `AdminConfig` to turn this off.

## Custom form fields

Use `Meta.custom_form_fields` to replace generated model inputs with fields from
`patera.admin.custom_elements`:

- `TagsInput`: tag entry, submitted as a JSON array encoded as text.
- `PasswordInput`: masked password entry, never prefilled with a stored value.
- `SelectInput`: selection from value/label options declared in model metadata.
- `SummernoteEditor`: rich text editing with configurable toolbar and image uploads.
- `FileInput`: file uploads with file-type and browser-side size constraints.
- `DateInput`: date or date-and-time selection, with optional UTC conversion.
- `LatexInput`: single-line or multiline text with live LaTeX math preview.

See the [Admin dashboard guide](../../docs/extensions/admin.md#custom-form-fields)
for configuration examples and submitted-value handling.

## License

MIT. See [LICENSE](https://github.com/MarkoSterk/Patera/blob/main/LICENSE).
