Skip to main content

Generic FastAPI + SQLAlchemy admin backend.

Project description

xladmin

xladmin это backend-пакет админки для FastAPI + SQLAlchemy.

Важно:

  • имя пакета в PyPI: xladmin
  • импорт в Python: from xladmin import ...
  • исходники монорепы: Artasov/xladmin

Основной API

  • AdminConfig — корневой декларативный конфиг
  • ModelConfig — конфиг одной ORM-модели
  • FieldConfig — переопределение поведения конкретного поля
  • BulkActionConfig — кастомное действие над несколькими объектами
  • ObjectActionConfig — кастомное действие над одним объектом
  • ModelsBlock — блок моделей для sidebar и overview
  • HttpConfig — контракт интеграции с проектом
  • create_router(...) — фабрика FastAPI-router

Короткие имена считаются основными. Старые Admin* имена и create_admin_router(...) оставлены как alias для совместимости.

Минимальный пример

from xladmin import AdminConfig, HttpConfig, ModelConfig, create_router

from src.core.auth.dependencies import get_current_user
from src.core.db.session import get_db_session
from src.modules.identity.models import UserORM


xladmin_config = AdminConfig(
    models=(
        ModelConfig(model=UserORM),
    ),
)

router = create_router(
    HttpConfig(
        registry=xladmin_config,
        get_db_session_dependency=get_db_session,
        get_current_user_dependency=get_current_user,
        is_allowed=lambda user: bool(user.is_staff),
    ),
)

ModelConfig(model=UserORM) уже достаточно для базовой админки. Библиотека сама достроит:

  • slug
  • title
  • базовые search_fields
  • базовый ordering

Что есть в библиотеке

  • list / detail / create / patch / delete
  • bulk actions и object actions
  • relation choices
  • model descriptions
  • model blocks
  • RU / EN locale
  • delete preview для single delete и bulk delete

Совместимость

  • FastAPI >=0.115,<1.0
  • Pydantic >=2.9,<3.0
  • SQLAlchemy >=2.0,<3.0

Документация

Project details


Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

xladmin-0.1.4.tar.gz (18.9 kB view details)

Uploaded Source

Built Distribution

If you're not sure about the file name format, learn more about wheel file names.

xladmin-0.1.4-py3-none-any.whl (15.8 kB view details)

Uploaded Python 3

File details

Details for the file xladmin-0.1.4.tar.gz.

File metadata

  • Download URL: xladmin-0.1.4.tar.gz
  • Upload date:
  • Size: 18.9 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? Yes
  • Uploaded via: twine/6.1.0 CPython/3.13.7

File hashes

Hashes for xladmin-0.1.4.tar.gz
Algorithm Hash digest
SHA256 883cecf30965190e1f74740eccb599f4e79a3a7d23a8ef25911889f3a9d28667
MD5 18cf49aeb3144af2671d050c4b922788
BLAKE2b-256 5c4e6f3c1739a3caa1ed82ecb83124181541c82f350a3432b0974b2cce813425

See more details on using hashes here.

Provenance

The following attestation bundles were made for xladmin-0.1.4.tar.gz:

Publisher: backend.yml on Artasov/xladmin

Attestations: Values shown here reflect the state when the release was signed and may no longer be current.

File details

Details for the file xladmin-0.1.4-py3-none-any.whl.

File metadata

  • Download URL: xladmin-0.1.4-py3-none-any.whl
  • Upload date:
  • Size: 15.8 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? Yes
  • Uploaded via: twine/6.1.0 CPython/3.13.7

File hashes

Hashes for xladmin-0.1.4-py3-none-any.whl
Algorithm Hash digest
SHA256 e5cf6c9fb98c3ab7df694e59b58ffa9cda678f19d1b6a0ae896262eed54f6744
MD5 87f88970ec3b0e72cf2f7179e7767251
BLAKE2b-256 4abd3736d253d77a6aebd84c7b053db150c4daddb7e09b3260769bcde1ef6ea3

See more details on using hashes here.

Provenance

The following attestation bundles were made for xladmin-0.1.4-py3-none-any.whl:

Publisher: backend.yml on Artasov/xladmin

Attestations: Values shown here reflect the state when the release was signed and may no longer be current.

Supported by

AWS Cloud computing and Security Sponsor Datadog Monitoring Depot Continuous Integration Fastly CDN Google Download Analytics Pingdom Monitoring Sentry Error logging StatusPage Status page