summaryrefslogtreecommitdiff
path: root/docs/db-api.txt
diff options
context:
space:
mode:
authorRussell Keith-Magee <russell@keith-magee.com>2006-01-18 13:25:13 +0000
committerRussell Keith-Magee <russell@keith-magee.com>2006-01-18 13:25:13 +0000
commit5f2ffee66e4480a695d3a718a5c9922371e6c731 (patch)
tree2852d9fc4d8909f0c92b2595bcc3e827e75eff5d /docs/db-api.txt
parent186c09d96f301ef9430e301fc76f3358cdf9a088 (diff)
magic-removal: Refs #1219 -- added documentation for bulk delete feature.
git-svn-id: http://code.djangoproject.com/svn/django/branches/magic-removal@2048 bcc190cf-cafb-0310-a4f2-bffc1f526a37
Diffstat (limited to 'docs/db-api.txt')
-rw-r--r--docs/db-api.txt16
1 files changed, 16 insertions, 0 deletions
diff --git a/docs/db-api.txt b/docs/db-api.txt
index 5261ab6fda..1fe77ebfb0 100644
--- a/docs/db-api.txt
+++ b/docs/db-api.txt
@@ -544,6 +544,22 @@ deletes the object and has no return value. Example::
>>> c.delete()
+Objects can also be deleted in bulk using the same query parameters that are
+used for get_object and other query methods. For example::
+
+ >>> Polls.objects.delete(pub_date__year=2005)
+
+would bulk delete all Polls with a year of 2005. A bulk delete call with no
+parameters would theoretically delete all data in the table. To prevent
+accidental obliteration of a database, a bulk delete query with no parameters
+will throw an exception. If you actually want to delete all the data in a
+table, you must add a ``DELETE_ALL=True`` argument to your query.
+For example::
+
+ >>> Polls.objects.delete(DELETE_ALL=True)
+
+would remove all Poll instances from the database.
+
Comparing objects
=================