Daisy Admin for Starlette/FastAPI
Documentation: https://docs.bhuwanpandey.com.np
Source Code: https://github.com/BhuwanPandey/fastdaisy-admin
Fastdaisy-admin is an admin panel with DaisyUI for managing SQLAlchemy models. It offers a dashboard experience similar to Django Admin and combining the design of django-daisy with the same functionality of Sqladmin.
Features
-
SQLAlchemy sync/async Core Database ORM
-
Starlette sync/async Backend Server
-
WTForms Form Building
-
SQLModel sync/async Database ORM
-
DaisyUI Admin UI
-
Django-Admin Similar Features
Installation
Install using pip:
pip install fastdaisy-admin
Install using uv:
uv add fastdaisy-admin
Quickstart
import contextlib
from sqlalchemy import Column, Integer, String, Text, create_engine, ForeignKey
from sqlalchemy.orm import declarative_base,relationship,sessionmaker
Base = declarative_base()
engine = create_engine(
"sqlite:///example.db",
connect_args={"check_same_thread": False},
)
Session = sessionmaker(bind=engine)
class User(Base):
__tablename__ = "users"
id = Column(Integer, primary_key=True)
name = Column(String)
books = relationship("Book", back_populates="author", cascade="all, delete-orphan")
class Book(Base):
__tablename__ = 'books'
id = Column(Integer, primary_key=True)
title = Column(String)
description = Column(Text)
author_id = Column(Integer, ForeignKey('users.id'))
author = relationship("User", back_populates="books")
@contextlib.asynccontextmanager
async def lifespan(app):
Base.metadata.create_all(engine) # create teables
yield
secret_key="secret_key"
With FastAPI:
from fastapi import FastAPI
from fastdaisy_admin import Admin, ModelView
app = FastAPI(lifespan=lifespan)
admin = Admin(
app,
secret_key,
engine
)
class UserAdmin(ModelView):
model=User
column_list = [User.id, User.name]
admin.add_view(UserAdmin)
With Starlette:
from fastdaisy_admin import Admin, ModelView
from starlette.applications import Starlette
app = Starlette(lifespan=lifespan)
admin = Admin(
app,
secret_key,
engine
)
class BookAdmin(ModelView):
model=Book
column_list = ['id', Book.title]
admin.add_view(BookAdmin)
Now visiting /admin on your browser you can see the Admin dashboard.
To active authentication
from fastdaisy_admin.auth.models import BaseUser
#override BaseUser [optional]
class User(Base, BaseUser):
__tablename__ = "users"
books = relationship("Book", back_populates="author", cascade="all, delete-orphan")
class Book(Base):
__tablename__ = 'books'
...
admin = Admin(
app,
secret_key,
engine,
authentication=True,
auth_model=User
)
create superuser with
fastdaisy-admin createsuperuser
Metadata
Release files for fastdaisy-admin 0.0.81
For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.
Source distribution (sdist)
| File | Size | Uploaded | Provenance | Actions |
|---|---|---|---|---|
| fastdaisy_admin-0.0.81.tar.gz | 1.3 MB | Without provenance | Details for fastdaisy_admin-0.0.81.tar.gz |
Built distribution (wheel)
| File | Interpreter | ABI | Platform | Actions Reset |
|---|---|---|---|---|
| fastdaisy_admin-0.0.81-py3-none-any.whl | Python 3 | none | any | Details for fastdaisy_admin-0.0.81-py3-none-any.whl |
Total release size: 2.6 MB
Release files / fastdaisy_admin-0.0.81.tar.gz
| Download URL | fastdaisy_admin-0.0.81.tar.gz |
|---|---|
| Size | 1.3 MB |
| Tags | Source |
|
SHA-256 checksum How to use checksums |
97ef9a346c08e4320d42079a7b0391c79ed6bbf4dc0929a05c519486b1108217
|
|
BLAKE2b-256 checksum How to use checksums |
fe1431454fa5c4e9c04ccfd9f038898ce7572e37666b7c95246c61ee33d69039
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
uv/0.8.14
|
Release files / fastdaisy_admin-0.0.81-py3-none-any.whl
| Download URL | fastdaisy_admin-0.0.81-py3-none-any.whl |
|---|---|
| Size | 1.3 MB |
| Tags | Python 3 |
|
SHA-256 checksum How to use checksums |
efdcfeccef7b857941b4caf10cc93af943bdc704353f593a137814844522ce79
|
|
BLAKE2b-256 checksum How to use checksums |
fdba876b95261e426c960d8671f88a83502d85d3fd8f14875b2e0f8852009913
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
uv/0.8.14
|
Security for fastdaisy-admin 0.0.81
Provenance
Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.
No provenance found
None of the files in this release were uploaded with provenance metadata.
A note on package security
PyPI is a repository for distributing packages, not a service for auditing them. While third-party security researchers and our staff do their best to detect and remove malicious packages, PyPI cannot guarantee the quality, security or suitability of any given package.
To learn more about protecting yourself from malicious actors, visit our package security documentation.