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.0.tar.gz (24.6 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.0-py3-none-any.whl (27.3 kB view details)

Uploaded Python 3

File details

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

File metadata

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

File hashes

Hashes for pyfost_adminui-0.1.0.tar.gz
Algorithm Hash digest
SHA256 53669fd94bc9acc248f301b1473a2f893c30aed676b3ea89dd72b9a19312b0b7
MD5 7d29f6ccd48dc0517f681f24bf380a33
BLAKE2b-256 45a9f9ae42a1e59e2cf0556d34099ef301c6b62940470f2648c6660a8ffb1664

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for pyfost_adminui-0.1.0-py3-none-any.whl
Algorithm Hash digest
SHA256 e6122cbed41b3b72a795b22cf83741667295c9f18536af3352b5f781aac2e1d1
MD5 8781bf89ef99ad8614bd940d370b6d3c
BLAKE2b-256 307b86ff3b1b9c1d720580c653d9f9d23262cb1a62c2853a5541e1c59c9438d3

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