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.3.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.3-py3-none-any.whl (27.3 kB view details)

Uploaded Python 3

File details

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

File metadata

  • Download URL: pyfost_adminui-0.1.3.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.3.tar.gz
Algorithm Hash digest
SHA256 f67826eff8654ec0ec78f473b1868c18b388e617d228ef97d3e1bca80b522eeb
MD5 5771b6a6e4dd00f133729bfc2908971a
BLAKE2b-256 12cab887f25bde335bc122661e7323df289de1def9b81d9fe6e41b1158d0f168

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for pyfost_adminui-0.1.3-py3-none-any.whl
Algorithm Hash digest
SHA256 7adffb62860b832bd04961e7017878fc4153ed17b7f233f05ea72eb783061d5f
MD5 a70a841f0750cbbd6b634ac4fee34e2b
BLAKE2b-256 fdac912a7cca8a0044686c10884587065d88a80f77464a435d2c8122325f63a5

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