Skip to main content

General-purpose admin panel framework powered by FastAPI. Some call it heavenly in its brilliance.

Project description

Brilliance Admin

PyPI License CI

General-purpose admin panel framework powered by FastAPI. Some call it heavenly in its brilliance.

  • Serves a prebuilt SPA frontend as static files
  • Generates schemas for frontend sections on the backend
  • Provides a backend-driven API for admin interfaces
  • Designed for fast data management and data viewing from any sources
  • Inspired by Django Admin and Django REST Framework
  • Focused on minimal boilerplate and simplified backend-controlled configuration

Live Demo | Example App | Documentation (todo)

Features:

  • Tables with full CRUD support, including filtering, sorting, and pagination.
  • Ability to define custom table actions with forms, response messages, and file uploads.
  • SQLAlchemy integration with automatic field generation from models.
  • Authorization via any account data source.
  • Localization support with language selection in the interface.

How to use it

Installation:

pip install brilliance-admin

You need to generate AdminSchema instance:

from admin_panel import schema

admin_schema = schema.AdminSchema(
    title='Admin Panel',
    auth=YourAdminAuthentication(),
    groups=[
        schema.Group(
            slug='example',
            title='Example',
            icon='mdi-star',
            categories=[
                CategoryExample(),
            ]
        ),
    ],
)

admin_app = admin_schema.generate_app()

# Your FastAPI app
app = FastAPI()
app.mount('/admin', admin_app)

SQLAlchemy integration

Brilliance Admin supports automatic schema generation from SQLAlchemy and provides a ready-made CRUD implementation for tables.

from admin_panel import sqlalchemy
from admin_panel.translations import TranslateText as _

from your_project.models import Terminal


class TerminalAdmin(sqlalchemy.SQLAlchemyAdmin):
    db_async_session = async_sessionmaker
    model = Terminal
    title = _('terminals')
    icon = 'mdi-console-network-outline'
    
    ordering_fields = ['id']
    search_fields = ['id', 'title']

    table_schema = sqlalchemy.SQLAlchemyFieldsSchema(
        model=Terminal, 
        list_display=['id', 'merchant_id'],
    )
    table_filters = sqlalchemy.SQLAlchemyFieldsSchema(
        model=Terminal, 
        fields=['id', 'created_at'],
        created_at=schema.DateTimeField(range=True),
    )


category = TerminalAdmin()

Now, the TerminalAdmin instance can be passed to categories.

Can be used both via inheritance and instancing

For SQLAlchemyFieldsSchema

class TerminalTableSchema(sqlalchemy.SQLAlchemyFieldsSchema):
    model = Terminal
    fields = ['id', 'created_at']

    created_at=schema.DateTimeField(range=True)


class TerminalAdmin(sqlalchemy.SQLAlchemyAdmin):
    table_schema = TerminalTableSchema()

And SQLAlchemyAdmin category schema itself

If table_schema is not specified, it will be generated automatically and will include all discovered fields and relationships of the table in the output.

category = sqlalchemy.SQLAlchemyAdmin(db_async_session=async_sessionmaker, model=Terminal)

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

brilliance_admin-0.41.0.tar.gz (3.7 MB view details)

Uploaded Source

Built Distribution

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

brilliance_admin-0.41.0-py3-none-any.whl (3.7 MB view details)

Uploaded Python 3

File details

Details for the file brilliance_admin-0.41.0.tar.gz.

File metadata

  • Download URL: brilliance_admin-0.41.0.tar.gz
  • Upload date:
  • Size: 3.7 MB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: uv/0.5.29

File hashes

Hashes for brilliance_admin-0.41.0.tar.gz
Algorithm Hash digest
SHA256 990149ea7568e2bc00b54a2ad119d3559a8d63d911ecdfe541953023effb874e
MD5 5e3e2a4a9c2b739a9222ecaabb544819
BLAKE2b-256 59b2d10f479159e731d37a5020b17267cd4bc71a6735fa6cfc7d313be301905e

See more details on using hashes here.

File details

Details for the file brilliance_admin-0.41.0-py3-none-any.whl.

File metadata

File hashes

Hashes for brilliance_admin-0.41.0-py3-none-any.whl
Algorithm Hash digest
SHA256 88cdf1a45e00f8f91f3de6dedbd7f8058e5df25104c0eb015aad481061aa8c46
MD5 6f8cfc0892d893fe187a4b53d01b19a8
BLAKE2b-256 bd53cb32ef913d1808bc70a31fa5a4e8311b06bedb6b1cf72e357eb44e2b40a0

See more details on using hashes here.

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