1There are seven possible actions to take when such event occurs:
2
3CASCADE: When the referenced object is deleted, also delete the objects that have references to it
4 (when you remove a blog post for instance, you might want to delete comments as well).
5 SQL equivalent: CASCADE.
6
7PROTECT: Forbid the deletion of the referenced object.
8 To delete it you will have to delete all objects that reference it manually.
9 SQL equivalent: RESTRICT.
10
11RESTRICT: (introduced in Django 3.1) Similar behavior as PROTECT that matches SQL's RESTRICT more accurately. (See django documentation example)
12SET_NULL: Set the reference to NULL (requires the field to be nullable).
13 For instance, when you delete a User, you might want to keep the comments he posted on blog posts,
14 but say it was posted by an anonymous (or deleted) user.
15 SQL equivalent: SET NULL.
16
17SET_DEFAULT: Set the default value. SQL equivalent: SET DEFAULT.
18
19SET(...): Set a given value. This one is not part of the SQL standard and is entirely handled by Django.
20
21DO_NOTHING: Probably a very bad idea since this would create integrity issues in your database
22 (referencing an object that actually doesn't exist). SQL equivalent: NO ACTION.
1HTTP 200 OK
2Allow: GET, HEAD, OPTIONS
3Content-Type: application/json
4Vary: Accept
5
6{
7 "count": 0,
8 "next": null,
9 "previous": null,
10 "results": []
11}