What kloudmint can do¶
Everything kloudmint gives you out of the box, by behaviour. Read this before writing admin code (or before asking an AI assistant to): if a behaviour below is what you need, use the listed class instead of hand-writing it. The Since version is the first kloudmint release that has it.
Instead of hand-writing... use this¶
| Instead of hand-writing | Use | Since |
|---|---|---|
| Hand-wiring sqladmin Admin, auth, templates and per-view permission registration. | Kloudmint | 0.1.1 |
| Writing is_accessible / check_can_* permission checks per view. | RBACModelView | 0.1.1 |
| Hand-writing roles/permissions tables and relationships. | create_rbac_models | 0.1.1 |
| Writing a sqladmin AuthenticationBackend with session handling. | KloudmintAuth | 0.1.1 |
| Building a custom OTP login flow and login template. | KloudmintOtpAuth | 0.1.2 |
| Free-text resource/action fields where typos silently grant nothing. | register_resource / PermissionFormMixin | 0.1.1 |
| Per-project Celery setup and task-outcome reporting. | Task helpers (Celery) | 0.1.9 |
| A custom screen for assigning many permissions to a role. | Role permission grid | 0.2.0 |
| Hand-written guards against editing/deleting super_admin or removing your own access. | Protected roles | 0.3.0 |
| Custom list templates and per-column search code. | List UI + column filters | 0.4.1 |
| ~70 lines per child table of filter/query/prefill/redirect plumbing and hand-built 'related' link columns. | ChildOf / Related / RelatedRecordsMixin | 0.4.2 |
| Manual has_permission() checks and register_resource() calls on every custom page. | RBACBaseView | 0.4.2 |
| Custom sqladmin filters and templates for multi-select / exact match. | Filters | 0.4.2 |
| Overriding list_query/count_query/delete_model on each view. | SoftDeleteMixin | 0.4.2 |
| Overriding scaffold_form to inject DB-driven choices. | DynamicChoicesMixin | 0.4.2 |
| Hand-written upload handling, S3 keys, validation and cleanup per view. | FileUploadMixin + FileSpec + storage | 0.4.2 |
| Inline lambdas/Markup for status badges, expiry warnings, file previews, links. | Column formatters | 0.4.2 |
| A hand-rolled activity log table, hooks and admin tab. | Audit trail | 0.4.2 |
| Custom routes/templates for tabbed or sectioned record pages. | DetailPage / Section | 0.4.2 |
| Patching sqladmin to hide empty sidebar categories; threading storage/audit through views. | Engine options | 0.4.2 |
| Hand-writing the lists, search, parent/child wiring and registration boilerplate of a new project's views.py. | kloudmint scaffold (CLI) | 0.6.1 |
| Hand-rolled export permission checks and export audit logging; exports that ignore the list's search and filters. | Tracked exports | 0.6.2 |
| Exports that time out or hold a web worker on big tables, and hand-built 'export, then email me a link' jobs. | Background exports | 0.6.2 |
| Hand-written Excel export code in a client project. | Excel (xlsx) export | 0.6.2 |
| Hand-written 'export selected' actions and custom JavaScript, and exports that ignore the ticked checkboxes. | Export selected rows | 0.6.3 |
| Custom code or JavaScript that stops users exporting a whole table. | Require a selection to export | 0.6.4 |
Engine and setup¶
Kloudmint¶
The mount point: wraps sqladmin.Admin, installs kloudmint templates, registers views/pages/detail pages.
- Since: 0.1.1
- Import:
from kloudmint import Kloudmint - Replaces: Hand-wiring sqladmin Admin, auth, templates and per-view permission registration.
- Details: RegisteringAdminViews.md
What you get:
- Mounts SQLAdmin into your existing FastAPI app at
base_url(default/admin); shares the app's DB and deploy -- no separate service - Template overrides are inserted after the project's own
templates_dir, so a project's own template always wins - The OTP login template is only loaded when the auth backend is
KloudmintOtpAuth register()takes model views,RBACBaseViewpages and detail pages in one call; it records each resource for the permission dropdown and gridregister()hands the engine'sstorage=to any upload view that has none of its own- Sidebar categories with no visible children are hidden (
hide_empty_categories=Trueby default) admin.rawis the escape hatch to the underlyingsqladmin.Admin
Engine options¶
Kloudmint(..., audit_backend, hide_empty_categories, storage, activity_log_model).
- Since: 0.4.2
- Import:
from kloudmint import Kloudmint - Replaces: Patching sqladmin to hide empty sidebar categories; threading storage/audit through views.
- Details: BuildingBlocks.md
What you get:
audit_backend,activity_log_model,storage,hide_empty_categoriesare allKloudmint(...)argumentstitle,logo_url,favicon_url,base_urlcustomise the shell
Views and pages¶
RBACModelView¶
Base class for every CRUD admin view; maps index/show/create/update/destroy to Role/Permission rows, honours can_* flags, auto-sortable columns, per-column header filters.
- Since: 0.1.1
- Import:
from kloudmint import RBACModelView - Replaces: Writing is_accessible / check_can_* permission checks per view.
- Details: RegisteringAdminViews.md
What you get:
- Gates every action by role:
index(list + sidebar),show,create,update,destroy - Respects static
can_create/can_edit/can_delete/can_view_details = Falseas well -- a view can be forced read-only - Permission resource name defaults to the model class name; override with
resource_name rbac_actions = [...]narrows which permissions the role grid offers for this view- Every plain mapped column on the list page is sortable automatically
- Every list page gets per-column header filters (
?cf_<column>=text) automatically - If you override
list_query(), callsuper().list_query(request)first or the column filters silently stop applying can_export = Falsemakes a view never exportable; to gate export per role userequire_export_permission=True(see Tracked exports)
RBACBaseView¶
Custom non-CRUD sidebar page with automatic RBAC gating (default action 'use'); Kloudmint.register() registers the resource.
- Since: 0.4.2
- Import:
from kloudmint import RBACBaseView - Replaces: Manual has_permission() checks and register_resource() calls on every custom page.
- Details: BuildingBlocks.md
What you get:
- Gates a custom page automatically: reachable and visible only with the
usepermission on its resource - Resource name defaults to the class name minus a trailing "Admin"; set
resource_nameto share one permission across pages Kloudmint.register()mounts it and registers the resource, so it appears in the permission gridis_accessible/is_visiblestay plain sync methods (SQLAdmin calls them without await)- Only gates the page; a handler with several sub-actions still needs its own
has_permission()check
Models¶
create_rbac_models¶
Generates Role and Permission models on the host app's declarative Base.
- Since: 0.1.1
- Import:
from kloudmint.models import create_rbac_models - Replaces: Hand-writing roles/permissions tables and relationships.
- Details: CreatingTables.md
What you get:
- Returns
(Role, Permission)bound to your own declarativeBase, so they live in your database - A Permission row is one
(role, resource, action)grant; that triple is unique - Deleting a Role deletes its Permission rows (cascade)
RoleMixin/PermissionMixincan be extended with extra columns- You still create the tables yourself (Alembic migration)
Login¶
KloudmintAuth¶
Session-based username+password login backend; implement verify_credentials and load_user.
- Since: 0.1.1
- Import:
from kloudmint import KloudmintAuth - Replaces: Writing a sqladmin AuthenticationBackend with session handling.
- Details: AuthenticationSetup.md
What you get:
- Session-based login: success stores the user id in a signed session cookie (
secret_key) - Every
/admin/*request calls yourload_user()and setsrequest.state.admin_user-- what all permission checks read - Logout clears the session
- You implement only
verify_credentials()andload_user()(eager-loadrole.permissionsto avoid N+1 queries) - Kloudmint does no password hashing -- use whatever your project already uses
KloudmintOtpAuth¶
Passwordless two-step email-OTP login; implement find_user/issue_otp/send_otp/verify_otp.
- Since: 0.1.2
- Import:
from kloudmint import KloudmintOtpAuth - Replaces: Building a custom OTP login flow and login template.
- Details: AuthenticationSetup.md
What you get:
- Passwordless two-step login using SQLAdmin's single login form: username first, then the emailed code typed into the password field
- Step 1 issues and sends the code, then shows "check your email" instead of an error
- You implement
find_user,issue_otp,send_otp,verify_otp,load_user-- kloudmint does not generate, store or send codes itself - The OTP login template is installed automatically for this backend only
Roles and permissions¶
register_resource / PermissionFormMixin¶
Registry of permission resources; PermissionFormMixin renders resource/action as dropdowns and adds Role/Resource/Action list filters.
- Since: 0.1.1
- Import:
from kloudmint import PermissionFormMixin, register_resource - Replaces: Free-text resource/action fields where typos silently grant nothing.
- Details: RoleAndPermissionManagement.md
What you get:
- Permission
resourceandactionbecome dropdowns, so a typo can't silently grant nothing - The resource dropdown fills itself from every view passed to
register(); override withresources/actions - Adds Role / Resource / Action dropdown filters on the Permission list (set
role_modelfor the Role filter) register_resource("Name", actions=["use"])makes a non-model page grantable- Registry is filled at process startup; views registered later won't appear until restart
Role permission grid¶
Checkbox grid to edit a role's permissions: admin.enable_permission_matrix(Role, Permission) + RolePermissionsLinkMixin.
- Since: 0.2.0
- Import:
from kloudmint import RolePermissionsLinkMixin - Replaces: A custom screen for assigning many permissions to a role.
- Details: RoleAndPermissionManagement.md
What you get:
- One page per role (
<base_url>/role-permissions/<role id>): resources down the side, actions across, a checkbox per cell - Select-all on every row and column, plus None / Read-only / Full access buttons
- One Save adds and removes rows in the existing
permissionstable -- no schema change or migration - Only users with
Role/updatecan open or save it - You can't save a change to your own role that removes
Role/indexorRole/update(prevents locking yourself out) - Rows for unregistered resources/actions are left untouched on save
- Every registered resource appears as a row, including custom pages
- Enable with
admin.enable_permission_matrix(Role, Permission); addRolePermissionsLinkMixinto the Role view for a "Manage permissions" link
Protected roles¶
admin.protect_roles(Role, Permission) + ProtectedRolesMixin/ProtectedUsersMixin make super_admin un-editable/un-deletable and block self-lockout.
- Since: 0.3.0
- Import:
from kloudmint import ProtectedRolesMixin, ProtectedUsersMixin - Replaces: Hand-written guards against editing/deleting super_admin or removing your own access.
- Details: RoleAndPermissionManagement.md
What you get:
- Opt-in:
admin.protect_roles(Role, Permission, ["super_admin", ...]); nothing is protected until you call it - A protected role can't be edited or deleted (buttons disappear, URLs return 403, bulk delete is refused if any selected row is protected)
- Its permission rows can't be edited or deleted and none can be added; the permission grid shows it read-only
ProtectedUsersMixin: a user can't delete their own accountProtectedUsersMixin: you can't delete, deactivate or move off the role the last active user who holds a protected role- Put the mixins before
RBACModelView; if your view overrideson_model_change, callsuper()or the guard never runs - Protected role ids are cached ~30 seconds
List page UI¶
List UI + column filters¶
Overridden layout/list templates: breadcrumbs, pinned logout, column show/hide, per-column header filters (cf_
- Since: 0.4.1
- Import:
(automatic -- no import) - Replaces: Custom list templates and per-column search code.
- Details: BuildingBlocks.md
What you get:
- Breadcrumbs, a page title bar and a pinned sidebar logout showing the logged-in user
- Per-column header filters (
?cf_<column>=text) on everyRBACModelViewlist, with no per-view code - Column show/hide toggle on the list table
- The list "New" button copies the active filter query onto the create URL (used by
ChildOfprefill) - Templates sit behind the project's own
templates_dir, so a project can still override them
Parent / child tables¶
ChildOf / Related / RelatedRecordsMixin¶
Parent->child admin tables: FK auto-detect, multi-select parent filter, hide children of soft-deleted parents, parent prefill on create, redirect back to filtered list, related links with counts on the parent list.
- Since: 0.4.2
- Import:
from kloudmint import ChildOf, Related, RelatedRecordsMixin - Replaces: ~70 lines per child table of filter/query/prefill/redirect plumbing and hand-built 'related' link columns.
- Details: BuildingBlocks.md
What you get:
- Detects the foreign key to the parent automatically (set
parent_fk/parent_relationship_nameif the child has several FKs to the same parent) - Adds a multi-select parent filter to the child list (
?candidate_id=1,7,12) - Hides child rows whose parent is soft-deleted (parent uses
SoftDeleteMixin) - Prefills the parent field on create when the list is filtered to a single parent id
- Save returns to the filtered child list
Related(ChildAdmin, label=..., count=True)renders links (with live counts, one grouped query) from the parent list to each child's filtered list- Limitation: multi-id filters don't prefill the parent; "Save and add another" opens an unfiltered create form
Filters¶
Filters¶
MultiSelectForeignKeyFilter, MultiSelectValueFilter, ExactValueFilter with searchable dropdown templates.
- Since: 0.4.2
- Import:
from kloudmint import MultiSelectForeignKeyFilter, MultiSelectValueFilter, ExactValueFilter - Replaces: Custom sqladmin filters and templates for multi-select / exact match.
- Details: BuildingBlocks.md
What you get:
MultiSelectForeignKeyFilter: filter a foreign-key column by one or more ids with a searchable dropdownMultiSelectValueFilter: filter a string/enum column by several valuesExactValueFilter: exact match on a query param, for links that pre-filter a list without a dropdownChildOfadds the foreign-key filter for you
Mixins¶
SoftDeleteMixin¶
Soft delete via deleted_at: hides deleted rows from list/count/edit/details and turns delete into an update.
- Since: 0.4.2
- Import:
from kloudmint import SoftDeleteMixin - Replaces: Overriding list_query/count_query/delete_model on each view.
- Details: BuildingBlocks.md
What you get:
- "Delete" stamps a timestamp column (
soft_delete_field, defaultdeleted_at) instead of removing the row - List, count, edit and details queries all hide rows where it is set
- The model must already have the column (your migration); the mixin doesn't add it
- Put it before
RBACModelViewin the class bases
DynamicChoicesMixin¶
Form select choices computed from the database at form-build time via dynamic_form_args(db).
- Since: 0.4.2
- Import:
from kloudmint import DynamicChoicesMixin - Replaces: Overriding scaffold_form to inject DB-driven choices.
- Details: BuildingBlocks.md
What you get:
- Keeps dropdown choices fresh on every request (SQLAdmin caches scaffolded form classes on the view class)
- You implement
dynamic_form_args(db)returning per-fieldchoices/data
File uploads and storage¶
FileUploadMixin + FileSpec + storage¶
File upload fields stored via LocalStorage or S3Storage (kloudmint[s3]); Kloudmint(storage=) applies a default backend; cleans up on delete.
- Since: 0.4.2
- Import:
from kloudmint import FileUploadMixin, FileSpec, LocalStorage - Replaces: Hand-written upload handling, S3 keys, validation and cleanup per view.
- Details: BuildingBlocks.md
What you get:
- Adds validated file fields to create/edit forms: allowed
extensionsandmax_bytesperFileSpec - Stores the file through a storage backend and saves the key and original filename on the model
- Replacing a file deletes the old stored file; deleting the record deletes its stored files
- Leaving the field empty keeps the current file
LocalStorage(folder + public path) andS3Storage(kloudmint[s3]); any object withupload(),delete(),url()worksKloudmint(storage=...)sets the default backend for upload views and detail pages- Both built-in backends also offer optional
upload_path(path, filename)(no whole-file read into memory) andLocalStorage.local_path(key), which background exports use
Excel (xlsx) export¶
An xlsx format for exports, opt-in per view with export_types = ["csv", "json", "xlsx"] and pip install kloudmint[xlsx] (openpyxl). Works for instant and background exports.
- Since: 0.6.2
- Import:
(per view: export_types = ["csv", "json", "xlsx"]; pip install kloudmint[xlsx]) - Replaces: Hand-written Excel export code in a client project.
- Details: Exports.md
What you get:
- Not offered unless the view lists
xlsxinexport_types; requires the optionalxlsxextra (a clear message says what to install if it is missing) - Uses openpyxl's write-only mode, so a large sheet is written one row at a time
- Numbers, booleans and dates stay numbers/dates in Excel (tz-aware datetimes become naive UTC); other values become text; empty values are empty cells; control characters Excel rejects are dropped
- Honours the same search/filters/sort, permission, record and (above the threshold) background path as CSV and JSON
Column formatters¶
Column formatters¶
Factories for list/detail cells: badge, bool_badge, date, pre, json_pretty, link, action_links, file_preview, expiry_badge.
- Since: 0.4.2
- Import:
from kloudmint import formatters - Replaces: Inline lambdas/Markup for status badges, expiry warnings, file previews, links.
- Details: BuildingBlocks.md
What you get:
- Factories returning SQLAdmin-compatible formatters:
badge,bool_badge,date,pre,json_pretty,link,action_links,file_preview,expiry_badge - Use in
column_formatters(list) andcolumn_formatters_detail(details page)
Audit trail¶
Audit trail¶
create_activity_log_model, KloudmintAuditBackend, AuditDiffMixin (field-level diffs), ActivityLogAdminBase read-only tab.
- Since: 0.4.2
- Import:
from kloudmint import create_activity_log_model, KloudmintAuditBackend, AuditDiffMixin - Replaces: A hand-rolled activity log table, hooks and admin tab.
- Details: BuildingBlocks.md
What you get:
create_activity_log_model(Base)makes the ActivityLog table (actor email, action, resource, row id, changes, time); you add the migration- With
KloudmintAuditBackend, everyRBACModelViewcreate/update/delete is logged with no application code AuditDiffMixin+audit_fieldslogs field-level{field: {old, new}}diffs for chosen fieldsActivityLogAdminBasegives a read-only Activity Log tab (create/edit/delete disabled)
Tracked exports¶
An export permission, a record of every export (who, what, filters, rows, outcome), and an export that matches the list on screen. Opt-in via Kloudmint(file_export_model=, require_export_permission=, export_max_rows=).
- Since: 0.6.2
- Import:
from kloudmint import create_file_export_model, FileExportAdminBase - Replaces: Hand-rolled export permission checks and export audit logging; exports that ignore the list's search and filters.
- Details: Exports.md
What you get:
- Opt-in: with none of the options a project behaves exactly as before
require_export_permission=Trueadds anexportaction to each exportable view (a column in the role permission grid); without it the request gets a 403 and nothing is sent or recorded. Roles that can export today lose it until granted- A view with
can_export = Falsenever offers or accepts export, whatever a role holds file_export_model=(fromcreate_file_export_model(Base), needs an Alembic migration) records each export: resource, format, exact query string, row count, who, status and error- Status is the real outcome:
successonly after the whole file was sent; building failures and interrupted downloads arefailedwith a short reason (class + short message, never full row data) - An export that cannot be recorded does not happen (fails before any row is read)
- The export applies the list's own
list_query, SQLAdmin filters, sort and search, so it matches the screen; the Export links carry the page's query string and are hidden from roles withoutexport export_max_rows=caps an export (0 = no cap)FileExportAdminBasegives a read-only Exports screen: a user sees only their own exports; theallpermission shows everyone's; it cannot itself be exported- Needs a synchronous engine for the export record. Small exports still stream during the request; big ones can run in the background (see Background exports)
Background exports¶
Exports of more rows than a threshold run in the background: the request queues a row and sends the user to the Exports screen; a job writes the file in batches, saves it through the storage backend, and the user downloads it from the Exports screen. Opt-in via Kloudmint(export_background=ExportBackground(...)).
- Since: 0.6.2
- Import:
from kloudmint import ExportBackground, run_export, purge_expired - Replaces: Exports that time out or hold a web worker on big tables, and hand-built 'export, then email me a link' jobs.
- Details: Exports.md
What you get:
- Needs
file_export_model=and a storage backend (storage=on Kloudmint orExportBackground(storage=)); use a PRIVATE storage, never a public static mount - An export of MORE rows than
threshold(default 5000, counted after search/filters and the row cap) is queued: aqueuedrow is written and the user is redirected to the Exports screen; at or under the threshold it streams as before - A user who cannot open the Exports screen (no FileExport
index) gets the instant export instead, since they could never download a queued one - The job runs as the user who asked: it re-loads them, re-checks their permission, and runs the view's own
list_query+ filters + sort + search, so the file matches the screen - Rows are read in batches (
batch_size) and written to a temp file, then stored via the backend (upload_pathif it has one, else the bytesupload); CSV and Excel stream, JSON is written as a stream too - Runners:
ThreadRunner(default, in-process, no extra infrastructure; a restart loses running jobs),CeleryRunner(task)(your task callsrun_export(admin, export_id); the worker must import your admin), or any object withsubmit(admin, export_id);InlineRunneris for tests only - Authenticated download at
/<exports identity>/<id>/download: the owner (or anallholder) only; local files are streamed, other backends redirect to their short-lived signed URL; never cached; 410 afterexpires_ator once purged expires_days(default 7) sets the expiry;purge_expired(admin)deletes expired files and clearsfile_key, keeping the record; run it from cron or Celery beat- A job whose worker died is marked failed (after
stale_after_minutes, default 60) when the Exports screen is opened; the screen refreshes itself while something is pending and announces a queued export - A failure to queue, or while building, is recorded as
failedwith a short reason;run_exportis safe to call twice (only aqueuedrow is picked up) - Optional
notify=callable(export_row)runs after success (e.g. send an email); an exception in it never fails the export - Limits: a synchronous engine only; the view's
list_queryand formatters run in a worker thread with a snapshot request (query string + user), so code that reads other request state will not see it
Export selected rows¶
With tracked exports on, the Export button exports only the rows ticked on the list (pks= ids, shown as "Export (3 selected)"); with nothing ticked it exports every row matching the current search and filters.
- Since: 0.6.3
- Import:
(automatic with Kloudmint(file_export_model=...)) - Replaces: Hand-written 'export selected' actions and custom JavaScript, and exports that ignore the ticked checkboxes.
- Details: Exports.md
What you get:
- Only when tracked exports are enabled; a project that did not opt in is unchanged (sqladmin's Export ignores ticks there)
- Rows ticked: the Export links carry pks= (the same row ids sqladmin's bulk actions use) and the button reads "Export (N selected)"; nothing ticked: every row matching the current search and filters, across all pages
- The selection narrows the view's own list_query, filters and search; it never replaces them, so a ticked row outside the view's scope cannot be exported by guessing ids
- Works for CSV, JSON and XLSX, composite primary keys, and background exports (the selected count decides whether it is queued)
- The selection is stored in the export record's filters (pks=...), so the Exports screen shows which rows were exported
- A malformed selection or more than 1000 ids is a 400, before anything is recorded; ids that do not exist are simply not exported
- Ticks are remembered across pages (since 0.6.4); the header box ticks the visible page and offers Select all matching rows
Require a selection to export¶
Kloudmint(export_requires_selection=True): Export only works on ticked rows or an explicit Select all matching rows. The button is greyed out until then, and the server refuses an export request with neither (400, before anything is recorded).
- Since: 0.6.4
- Import:
(option on Kloudmint(file_export_model=..., export_requires_selection=True)) - Replaces: Custom code or JavaScript that stops users exporting a whole table.
- Details: Exports.md
What you get:
- Opt-in: without it, nothing ticked still exports every row matching the current search and filters
- Browser: the Export button is greyed out and reads "Export (select rows)" until a row is ticked; clicking it while locked does nothing
- Server: an export request without ticked rows (no pks, an empty pks, or only filters/search) is a 400 before anything is recorded, so typing the URL does not bypass it
- The export permission is checked first (403 without it); a malformed selection is still a 400
- Works for CSV, JSON, XLSX and background exports; a hand-picked selection is at most 1000 ids per export; Select all matching rows exports the whole filtered list and is bounded by export_max_rows
- Ticked rows are remembered across pages (sessionStorage, per list, search and filter); a bar shows the count and Clear selection
- Header tick offers "Select all N matching rows" -> Export (all N); the server accepts that as select_all=1 (exactly the value 1)
- pks wins over select_all; select_all still needs the export permission and respects export_max_rows
Detail pages¶
DetailPage / Section¶
Extra view/edit pages for a record, declared as detail_pages=[DetailPage(...)] on a model view and auto-mounted by register().
- Since: 0.4.2
- Import:
from kloudmint import DetailPage, Section - Replaces: Custom routes/templates for tabbed or sectioned record pages.
- Details: BuildingBlocks.md
What you get:
- Extra view and edit pages for groups of a model's fields, declared as
detail_pages=[DetailPage(...)]on a model view register()mounts one sidebar entry per page automatically- RBAC reuses the parent view's resource:
showto view the page,updateto save it - Forms are built from each column's SQLAlchemy type (String/Text/Integer/Float/Boolean/Date/DateTime) and support
file_fields
Background tasks¶
Task helpers (Celery)¶
Optional Celery bootstrap: make_celery_app, KloudmintTask, set_task_event_hook. Needs kloudmint[tasks].
- Since: 0.1.9
- Import:
from kloudmint.tasks import make_celery_app, KloudmintTask, set_task_event_hook - Replaces: Per-project Celery setup and task-outcome reporting.
- Details: CustomPages.md
What you get:
- Entirely opt-in: nothing else in kloudmint imports Celery; install with
kloudmint[tasks] make_celery_appgives every project the same Celery bootstrapKloudmintTaskreports task success/failure through an optional hook set withset_task_event_hook
Command line tools¶
kloudmint scaffold (CLI)¶
kloudmint scaffold --base app.models:Base --out app/admin reads your SQLAlchemy models and writes a first-draft admin views.py with ChildOf/Related, SoftDeleteMixin, search and default sort.
- Since: 0.6.1
- Import:
(command line: kloudmint scaffold) - Replaces: Hand-writing the lists, search, parent/child wiring and registration boilerplate of a new project's views.py.
- Details: Scaffold.md
What you get:
- Preview by default (prints the code and a report);
--writecreates<out>/views.py - Never overwrites: if views.py exists the output goes to views.generated.py to diff
- Never edits your other files; outputs
GENERATED_VIEWS(foradmin.register(*GENERATED_VIEWS)) andRESOURCES(for the permission seed) - A many-to-one relationship through one foreign key that cascades on delete (or reverses a delete-orphan relationship) becomes a
ChildOfview, and the parent getsRelatedRecordsMixin+Related(..., count=True) - Two foreign keys to the same parent: sets
parent_fk/parent_relationship_namefor the owning one - A
deleted_atdatetime column addsSoftDeleteMixin(deleted rows are hidden in the admin) - Password, hash, token, secret, api key, otp, pepper and salt columns are left out unless
--include-sensitive - Foreign key columns show as the relationship; many-to-many shows as a multi-select; search columns picked by name;
created_atbecomes the default sort; long text/JSON stays out of the list - Anything it cannot decide safely (several owning parents, upload columns, password flow, binary columns, no display column) is a
# TODOcomment, not a guess - Skips kloudmint's own Role, Permission and activity-log models (the report says why)
- Does not generate migrations,
main.py, a seed script, formatters, enum dropdowns or upload specs