A Django app for semantic model relationships and nested forms
Project description
Semandjic
A Django app for handling nested forms and object trees with automatic relationship discovery.
Features
- Automatic form generation for related models
- Handles nested relationships recursively
- Prevents circular references
- Configurable depth and relationship handling
- Support for forward and backward relations
- Customizable field exclusion
- Tree visualization of model relationships
Installation
pip install semandjic
Quick Start
- Add to INSTALLED_APPS:
INSTALLED_APPS = [
...,
'semandjic',
]
- Configure settings (optional):
SEMANDJIC = {
'APP_LABEL': 'myapp',
'FIELDS_TO_EXCLUDE': {'id', 'modified_at'},
'MAX_DEPTH': 5,
'MAX_RELATED_OBJECTS': 10,
}
- Use in your views:
from django.urls import path
from semandjic.forms import NestedForms
from semandjic.views import ObjectTreeView
# Generate forms
classmap = NestedForms.build_classmap_from_prefix_and_model_class(
prefix='person',
model_class='myapp.Person'
)
forms = NestedForms.get_nested_forms_from_classmap(classmap)
# Or use the tree view
path('object/<str:model_class>/<int:pk>/',
ObjectTreeView.as_view(),
name='object-tree'),
Documentation
For more detailed documentation, visit our GitHub repository.
Development
To contribute:
# Clone the repository
git clone https://github.com/iSeeCI/semandjic.git
cd semandjic
# Create virtual environment
python -m venv venv
source venv/bin/activate # or `venv\Scripts\activate` on Windows
# Install development dependencies
pip install -e ".[dev]"
# Run tests
python runtests.py
License
MIT 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
semandjic-0.1.0.tar.gz
(18.3 kB
view details)
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
semandjic-0.1.0-py3-none-any.whl
(20.4 kB
view details)
File details
Details for the file semandjic-0.1.0.tar.gz.
File metadata
- Download URL: semandjic-0.1.0.tar.gz
- Upload date:
- Size: 18.3 kB
- Tags: Source
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/6.0.1 CPython/3.12.8
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
f6e55bfc35d3ff119b0e8456bc2b3e80f110ba040729054b62c6b3e319a24e81
|
|
| MD5 |
13b316fa343038f02444f6da402d66c1
|
|
| BLAKE2b-256 |
4dbcbfc2077589a5a87a2a2c32d48cea4eb899b38dc48ae728c66a89df4110c7
|
File details
Details for the file semandjic-0.1.0-py3-none-any.whl.
File metadata
- Download URL: semandjic-0.1.0-py3-none-any.whl
- Upload date:
- Size: 20.4 kB
- Tags: Python 3
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/6.0.1 CPython/3.12.8
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
b2857c493bd3083e73d2d291d22d69cba9e84f9409410739943853e2af09e5f6
|
|
| MD5 |
4252185d3ed65bf54e4dccad83c9e186
|
|
| BLAKE2b-256 |
80ce6e7a33ea41e2d9339588510d31b10672040a7c79feb47e4f50fdefa01e47
|