#34880: Required a post_save_action hook to perform additional action in admin.
-----------------------------------------+------------------------------
Reporter: AjmalPonneth | Owner: AjmalPonneth
Type: New feature | Status: assigned
Component: contrib.admin | Version: 4.2
Severity: Normal | Keywords:
Triage Stage: Unreviewed | Has patch: 0
Needs documentation: 0 | Needs tests: 0
Patch needs improvement: 0 | Easy pickings: 1
UI/UX: 0 |
-----------------------------------------+------------------------------
We need to provide a post_save_action hook in ModelAdmin in order to
perform additional actions after saving the object. This feature will be
useful if we are sending webhooks, notifications, etc. Overriding
ModelAdmin.save_model() is not possible if a m2m field is there.
{{{
def post_save_action(request, obj):
"""
Hook to perform an action after the 'Save' button has been pressed
when adding a new object.
"""
pass
...
self.save_model(request, new_object, form, not add)
self.save_related(request, form, formsets, not add)
self.post_save_action(request, new_object)
}}}
The method should call after the ModelAdmin.save_related() is completed.
--
Ticket URL: <https://code.djangoproject.com/ticket/34880>
Django <https://code.djangoproject.com/>
The Web framework for perfectionists with deadlines.
--
You received this message because you are subscribed to the Google Groups
"Django updates" group.
To unsubscribe from this group and stop receiving emails from it, send an email
to [email protected].
To view this discussion on the web visit
https://groups.google.com/d/msgid/django-updates/0107018adb0e42ef-30e4d5fd-e9e3-4bca-8f0b-31e02d7eddee-000000%40eu-central-1.amazonses.com.