diff options
| author | Tom Christie | 2013-12-04 15:00:19 +0000 |
|---|---|---|
| committer | Tom Christie | 2013-12-04 15:00:19 +0000 |
| commit | d2d1914e2e88b13b4c6b3808bc8d57bd47189085 (patch) | |
| tree | 40f6bb1106bc358c69d8df9be8e94e3ffff892e1 /api-guide/generic-views.html | |
| parent | 742d151c762fb4e76fecd263933c6be314863e52 (diff) | |
| download | django-rest-framework-d2d1914e2e88b13b4c6b3808bc8d57bd47189085.tar.bz2 | |
Build contribution guide docs
Diffstat (limited to 'api-guide/generic-views.html')
| -rw-r--r-- | api-guide/generic-views.html | 5 |
1 files changed, 4 insertions, 1 deletions
diff --git a/api-guide/generic-views.html b/api-guide/generic-views.html index e1ef2ea9..2828fa42 100644 --- a/api-guide/generic-views.html +++ b/api-guide/generic-views.html @@ -102,6 +102,7 @@ <li><a href="http://django-rest-framework.org/topics/browser-enhancements">Browser enhancements</a></li> <li><a href="http://django-rest-framework.org/topics/browsable-api">The Browsable API</a></li> <li><a href="http://django-rest-framework.org/topics/rest-hypermedia-hateoas">REST, Hypermedia & HATEOAS</a></li> + <li><a href="http://django-rest-framework.org/topics/contributing">Contributing to REST framework</a></li> <li><a href="http://django-rest-framework.org/topics/rest-framework-2-announcement">2.0 Announcement</a></li> <li><a href="http://django-rest-framework.org/topics/2.2-announcement">2.2 Announcement</a></li> <li><a href="http://django-rest-framework.org/topics/2.3-announcement">2.3 Announcement</a></li> @@ -346,11 +347,13 @@ class UserList(generics.ListCreateAPIView): return 20 return 100 </code></pre> -<p><strong>Save hooks</strong>:</p> +<p><strong>Save / deletion hooks</strong>:</p> <p>The following methods are provided as placeholder interfaces. They contain empty implementations and are not called directly by <code>GenericAPIView</code>, but they are overridden and used by some of the mixin classes.</p> <ul> <li><code>pre_save(self, obj)</code> - A hook that is called before saving an object.</li> <li><code>post_save(self, obj, created=False)</code> - A hook that is called after saving an object.</li> +<li><code>pre_delete(self, obj)</code> - A hook that is called before deleting an object.</li> +<li><code>post_delete(self, obj)</code> - A hook that is called after deleting an object.</li> </ul> <p>The <code>pre_save</code> 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.</p> <pre class="prettyprint lang-py"><code>def pre_save(self, obj): |
