From 332a485567420e844887344b6429d3b4db4b260b Mon Sep 17 00:00:00 2001 From: Jannis Leidel Date: Sun, 3 Jul 2011 17:56:43 +0000 Subject: Fixed #16115 -- Added ModelAdmin.save_related method to be able to do pre- or post-save operations for objects related to the parent object currently displayed. Thanks, Julien Phalip. git-svn-id: http://code.djangoproject.com/svn/django/trunk@16498 bcc190cf-cafb-0310-a4f2-bffc1f526a37 --- docs/ref/contrib/admin/index.txt | 10 ++++++++++ docs/releases/1.4.txt | 7 +++++++ 2 files changed, 17 insertions(+) (limited to 'docs') diff --git a/docs/ref/contrib/admin/index.txt b/docs/ref/contrib/admin/index.txt index 4b472e71f0..43057a31b0 100644 --- a/docs/ref/contrib/admin/index.txt +++ b/docs/ref/contrib/admin/index.txt @@ -978,6 +978,16 @@ templates used by the :class:`ModelAdmin` views: else: return ['name'] +.. method:: ModelAdmin.save_related(self, request, form, formsets, change) + + .. versionadded:: 1.4 + + The ``save_related`` method is given the ``HttpRequest``, the parent + ``ModelForm`` instance, the list of inline formsets and a boolean value + based on whether the parent is being added or changed. Here you can do any + pre- or post-save operations for objects related to the parent. Note + that at this point the parent object and its form have already been saved. + .. method:: ModelAdmin.get_readonly_fields(self, request, obj=None) .. versionadded:: 1.2 diff --git a/docs/releases/1.4.txt b/docs/releases/1.4.txt index 20f1ba63cf..781093123c 100644 --- a/docs/releases/1.4.txt +++ b/docs/releases/1.4.txt @@ -80,6 +80,13 @@ to work similarly to how desktop GUIs do it. The new hook :meth:`~django.contrib.admin.ModelAdmin.get_ordering` for specifying the ordering dynamically (e.g. depending on the request) has also been added. +``ModelAdmin.save_related()`` +~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ + +A new :meth:`~django.contrib.admin.ModelAdmin.save_related` hook was added to +:mod:`~django.contrib.admin.ModelAdmin` to ease the customization of how +related objects are saved in the admin. + Tools for cryptographic signing ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ -- cgit v1.3