Skip to content

feat: use ModelAdmin.save_model() and delete_model() in CRUD handlers#74

Merged
7tg merged 1 commit into
7tg:mainfrom
foogunlana:feat/use-save-model-in-crud-handlers
Mar 12, 2026
Merged

feat: use ModelAdmin.save_model() and delete_model() in CRUD handlers#74
7tg merged 1 commit into
7tg:mainfrom
foogunlana:feat/use-save-model-in-crud-handlers

Conversation

@foogunlana

Copy link
Copy Markdown
Contributor

Instead of calling form.save() and obj.delete() directly, the CRUD handlers now delegate to ModelAdmin.save_model() and delete_model() when a ModelAdmin is available. This ensures custom logic in those methods (slug generation, field computation, signal dispatch, etc.) is executed when objects are created, updated, or deleted via MCP.

Falls back to the previous behavior when no ModelAdmin is available.

Instead of calling form.save() and obj.delete() directly, the CRUD
handlers now delegate to ModelAdmin.save_model() and delete_model()
when a ModelAdmin is available. This ensures custom logic in those
methods (slug generation, field computation, signal dispatch, etc.)
is executed when objects are created, updated, or deleted via MCP.

Falls back to the previous behavior when no ModelAdmin is available.

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
@codecov

codecov Bot commented Mar 12, 2026

Copy link
Copy Markdown

Codecov Report

❌ Patch coverage is 76.92308% with 3 lines in your changes missing coverage. Please review.

Files with missing lines Patch % Lines
django_admin_mcp/handlers/crud.py 76.92% 3 Missing ⚠️

📢 Thoughts on this report? Let us know!

@7tg
7tg merged commit d80ce12 into 7tg:main Mar 12, 2026
16 of 17 checks passed
@7tg

7tg commented Mar 12, 2026

Copy link
Copy Markdown
Owner

thank you

@foogunlana

Copy link
Copy Markdown
Contributor Author

No problem. Thanks for building this!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants