aboutsummaryrefslogtreecommitdiffstats
path: root/docs/api-guide
diff options
context:
space:
mode:
authorPablo Recio2013-12-03 00:07:41 +0000
committerPablo Recio2013-12-03 00:07:41 +0000
commit699ec7236b326c97a98c6058280b822c701393fe (patch)
tree441d1f800e4d2cd02d2858bb8e177b9e39fb9805 /docs/api-guide
parent01040b077c16f69101249282b62506f08ebff651 (diff)
downloaddjango-rest-framework-699ec7236b326c97a98c6058280b822c701393fe.tar.bz2
Adds pre_delete and post_delete hooks on
Diffstat (limited to 'docs/api-guide')
-rwxr-xr-xdocs/api-guide/generic-views.md4
1 files changed, 3 insertions, 1 deletions
diff --git a/docs/api-guide/generic-views.md b/docs/api-guide/generic-views.md
index b9242724..83c3e45f 100755
--- a/docs/api-guide/generic-views.md
+++ b/docs/api-guide/generic-views.md
@@ -163,12 +163,14 @@ For example:
return 20
return 100
-**Save hooks**:
+**Save / deletion hooks**:
The following methods are provided as placeholder interfaces. They contain empty implementations and are not called directly by `GenericAPIView`, but they are overridden and used by some of the mixin classes.
* `pre_save(self, obj)` - A hook that is called before saving an object.
* `post_save(self, obj, created=False)` - A hook that is called after saving an object.
+* `pre_delete(self, obj)` - A hook that is called before deleting an object.
+* `post_delete(self, obj)` - A hook that is called after deleting an object.
The `pre_save` method in particular is a useful hook for setting attributes that are implicit in the request, but are not part of the request data. For instance, you might set an attribute on the object based on the request user, or based on a URL keyword argument.