Add your description here
Project description
sqladmin-inline
SQLAdmin Inline is an extension for sqladmin that brings Django-style inline editing to your SQLAlchemy models. It allows you to manage related records (one-to-many) directly within the parent model's form.
Features
- Django-style Inlines: Add, edit, and remove related records without leaving the main form.
- Async & Sync Support: Fully compatible with both asynchronous and synchronous SQLAlchemy sessions.
- Built-in Search & Pagination: Manage large numbers of child records with AJAX-powered search.
- Flexible Layouts: Supports modal-based editing and different positions (center or sidebar).
Installation
pip install sqladmin-inline
Full Example
Based on the provided demo.py, here is how you can set up a Post with inline Tags and Comments:
from sqladmin import Admin
from sqladmin_inline import InlineModelAdmin, ModelViewWithInlines, setup_inline_routes
# 1. Define the Inline configuration
class TagInline(InlineModelAdmin, model=Tag):
inline_label = "Tags"
icon = "fas fa-tag"
column_list = [Tag.name]
column_searchable_list = [Tag.name]
page_size = 5
class CommentInline(InlineModelAdmin, model=Comment):
inline_label = "Comments"
icon = "fa fa-comments"
layout = "center" # Displays below the main form
column_list = [Comment.body, Comment.author]
form_columns = [Comment.body, Comment.author]
# 2. Use ModelViewWithInlines for the parent model
class PostAdmin(ModelViewWithInlines, model=Post):
name_plural = "Posts"
icon = "fa-solid fa-newspaper"
inlines = [TagInline, CommentInline]
# 3. Initialize and register
app = FastAPI()
admin = Admin(app, engine, session_maker=session_mk)
# This step is CRITICAL to register AJAX routes and templates
setup_inline_routes(admin)
admin.add_view(PostAdmin)
Configuration Reference
InlineModelAdmin Attributes
- model: The SQLAlchemy model class (required).
- fk_attr: Explicit foreign key attribute name (auto-detected if omitted).
- column_list: Columns to display in the inline table.
- column_searchable_list: Columns to include in the AJAX search.
- layout: "center" (below form) or "sidebar" (right side).
- can_create, can_edit, can_delete: Permissions for the inline records.
Requirements
- SQLAdmin >= 0.16.0
- SQLAlchemy >= 2.0.0
- Starlette / FastAPI
Project details
Release history Release notifications | RSS feed
Download files
Download the file for your platform. If you're not sure which to choose, learn more about installing packages.
Source Distribution
Built Distribution
Filter files by name, interpreter, ABI, and platform.
If you're not sure about the file name format, learn more about wheel file names.
Copy a direct link to the current filters
File details
Details for the file sqladmin_inline-0.0.2.tar.gz.
File metadata
- Download URL: sqladmin_inline-0.0.2.tar.gz
- Upload date:
- Size: 31.7 kB
- Tags: Source
- Uploaded using Trusted Publishing? No
- Uploaded via: uv/0.11.6 {"installer":{"name":"uv","version":"0.11.6","subcommand":["publish"]},"python":null,"implementation":{"name":null,"version":null},"distro":{"name":"Ubuntu","version":"25.10","id":"questing","libc":null},"system":{"name":null,"release":null},"cpu":null,"openssl_version":null,"setuptools_version":null,"rustc_version":null,"ci":null}
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
80c29454c09bb18c0d1ca22abbc901d1ec8037f00e4b484968f23956bf604bb7
|
|
| MD5 |
7cde9e34f3376b5f8620b89e64aca7ce
|
|
| BLAKE2b-256 |
1476c43a1100c50ec3a41c810e830f3d89348c5ad5739137f113ad213db52aac
|
File details
Details for the file sqladmin_inline-0.0.2-py3-none-any.whl.
File metadata
- Download URL: sqladmin_inline-0.0.2-py3-none-any.whl
- Upload date:
- Size: 21.9 kB
- Tags: Python 3
- Uploaded using Trusted Publishing? No
- Uploaded via: uv/0.11.6 {"installer":{"name":"uv","version":"0.11.6","subcommand":["publish"]},"python":null,"implementation":{"name":null,"version":null},"distro":{"name":"Ubuntu","version":"25.10","id":"questing","libc":null},"system":{"name":null,"release":null},"cpu":null,"openssl_version":null,"setuptools_version":null,"rustc_version":null,"ci":null}
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
c438a506e7364202aff3c86c7d0b56bae66fcff6df182632a6e89741011efe43
|
|
| MD5 |
67682bcddf79a9109ecc34681742583f
|
|
| BLAKE2b-256 |
d261bd7f2fbabb7fa6270b5908ce0df8b7b1ed82139a847e03b7256743c52616
|