CRUD Package
The CRUD package is Zango's primary data management layer. It provides BaseCrudView, table classes, and form classes that together handle create, read, update, and delete operations for any model — with built-in role-based access, row actions, and a React frontend via CrudHandler.
What It Does
| Layer | Class | Purpose |
|---|---|---|
| Backend view | BaseCrudView | Wires a model, table, and form into a single endpoint |
| Table | ModelTable | Defines columns, sorting, search, and row actions |
| Form | BaseForm | Defines fields for create/edit operations |
| Frontend | CrudHandler | React component that renders the full list + detail UI |
When to Use CRUD
Use BaseCrudView when the operation maps cleanly to list / create / edit / delete on a single model. For multi-model flows, multi-step wizards, or custom business logic, write a plain Django class-based view instead.
Install Order
Packages must be installed in this order — CRUD depends on AppBuilder:
appbuilder → crud → workflow
Quick Example
Backend view:
from ...packages.crud.base import BaseCrudView
from .tables import PatientTable
from .forms import PatientForm
class PatientCrudView(BaseCrudView):
page_title = "Patients"
add_btn_title = "Add Patient" # required
table = PatientTable
form = PatientForm
def display_add_button_check(self, request):
return True
Frontend (React):
import { CrudHandler } from '@zango-core/crud/table';
const Patients = () => (
<CrudHandler api_endpoint="/patients/" headerProps={{ title: "Patients" }} />
);
Sections
| Section | Description |
|---|---|
| Installation | Install the package via App Panel |
| CRUD View | Configure BaseCrudView |
| Tables | Define columns and row actions |
| Forms | Define fields for create/edit |
| Frontend Integration | Use CrudHandler and FormRenderer in React |