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.4.tar.gz (24.9 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.4-py3-none-any.whl (27.7 kB view details)

Uploaded Python 3

File details

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

File metadata

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

File hashes

Hashes for pyfost_adminui-0.1.4.tar.gz
Algorithm Hash digest
SHA256 cacdd42d37b48c0eefa5042aadc9ca29ed21e8b170d137f39b16b08fb40da53c
MD5 1e81920877d5667db3f72068395980d7
BLAKE2b-256 79c2cd4cd66c0966126098bf945b2697a898656e9c6896c4d3902036dccceb95

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for pyfost_adminui-0.1.4-py3-none-any.whl
Algorithm Hash digest
SHA256 3b825c249465974a4f71a187860dfb9002a2e2c423f381b11a4692eddfd8aa1c
MD5 a1265003826b22ee1d4d00133e44fe61
BLAKE2b-256 09056a34deaf4031aaa16949c08de1c62fc14f70168c95efa03c67de02c394f7

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