Dronakurl / nicecrud

Edit your pydantic models with a nice GUI - CRUD Create Update Replace Delete
MIT License
20 stars 5 forks source link

NiceCRUD

NiceCRUD is a CRUD (Create, Read, Update, Delete) interface built with python. The library integrates with pydantic models and NiceGUI to handle data manipulation with a browser interface.

Features

Screenshots

Taken from the input_choices example:

CRUD Interface Screenshot - Grid of objects CRUD Interface Screenshot - Editing objects

Installation

To install NiceCRUD, use pip:

pip install niceguicrud

Quick Start

Here is a very basic example:


from nicegui import ui
from pydantic import BaseModel, Field

from niceguicrud import NiceCRUD

class MyModel(BaseModel, title="User"):
    id: int
    name: str = Field(title="Name")
    age: int = Field(gt=0, title="Age")

instance1 = MyModel(id=1, name="Alice", age=30)
instance2 = MyModel(id=2, name="Bob", age=25)
crud_app = NiceCRUD(basemodels=[instance1, instance2], id_field="id", heading="User Management")

ui.run()
Find more in the examples folder. Example Name Description
minimal The above minimal example
validation Example showcasing how pydantic validation features are used in the GUI
submodel Demonstrates usage of a pydantic submodel that can also be used in the GUI.
input_choices Shows the different input choices.
database Shows how to customize the update, create and delete operations

Contributing

Contributions are welcome!

License

This project is licensed under the MIT License. See the LICENSE.