Skip to content

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

Open
foogunlana wants to merge 1 commit into7tg:mainfrom
foogunlana:feat/use-save-model-in-crud-handlers
Open

feat: use ModelAdmin.save_model() and delete_model() in CRUD handlers#74
foogunlana wants to merge 1 commit into7tg:mainfrom
foogunlana:feat/use-save-model-in-crud-handlers

Conversation

@foogunlana
Copy link

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>
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.

1 participant