Skip to main content

Admin / CRUD frontend for pyfost webapps

Project description

⚠️ Not Production Ready ⚠️

pyfost.adminui

PyPI - Version PyPI - Python Version

Fost Admin / CRUD frontend


Table of Contents

Installation

pip install pyfost.adminui

Usage

Basic usage:

from __future__ import annotations

from my_app import get_fastapi_app

from pyfost.adminui import Admin
from pyfost.adminui import AdminModel, Field

# Define your models and their getters:

class Author(AdminModel):
    id : int
    name: str

def get_authors()->list[Author]:
    # fetch all authors here
    ... 

class Book(AdminModel):
    id: int
    title: str
    author: Author|None = None
    
async def get_books()->list[Book]:
    # fetch all books here
    # Note: this can be async
    ... 

# Configure your admin:
admin = Admin("/book_management")
admin.add_view(Author, get_authors)
admin.add_view(Book, get_books)

# Add the admin pages to your fastapi app:
app = get_fastapi_app()
admin.add_to(app)
ui.run_with(app)

# Now run your app and navigate to the `/book_management` page.

Customization

You can customize your admin pages by providing column and field renderers, by adding render methods to your models, etc... See examples for more details.

Examples

There are example usage in the pyfost.adminui.examples module.

You can run them with python -m pyfost.adminui.examples.<example_name>

Then browse to http://0.0.0.0:8001/admin

License

pyfost.adminui is distributed under the terms of the GNU GPL-3.0 or later license.

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

pyfost_adminui-0.1.0a1.tar.gz (24.2 kB view details)

Uploaded Source

Built Distribution

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

pyfost_adminui-0.1.0a1-py3-none-any.whl (26.7 kB view details)

Uploaded Python 3

File details

Details for the file pyfost_adminui-0.1.0a1.tar.gz.

File metadata

  • Download URL: pyfost_adminui-0.1.0a1.tar.gz
  • Upload date:
  • Size: 24.2 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: python-httpx/0.28.1

File hashes

Hashes for pyfost_adminui-0.1.0a1.tar.gz
Algorithm Hash digest
SHA256 b6f3adb3b6b4f4c43bb63622e7a8d9a2d1d637ae59981c994ac6c4d24e4da343
MD5 ab36a60397536afd6ee9112bc7cb877a
BLAKE2b-256 7fbc88e1ad0c747d522c7029d945dbf50ccc21c7a04a3574c730422d7b17c894

See more details on using hashes here.

File details

Details for the file pyfost_adminui-0.1.0a1-py3-none-any.whl.

File metadata

File hashes

Hashes for pyfost_adminui-0.1.0a1-py3-none-any.whl
Algorithm Hash digest
SHA256 b6b9ae5a7e56f7fdccc6dd2e23b22e66c89f696801cbeee6d317917bff89bf1d
MD5 0a53f0c7ec33404d49b15b131457b9a0
BLAKE2b-256 5fbcf5b7abcc6d36c108031ec56a18da396ccabd964a28be16457fc6539a1dcf

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