1
0
mirror of https://github.com/django/django.git synced 2025-11-07 07:15:35 +00:00

magic-removal: Fixed #1219 - Added bulk delete for objects.

git-svn-id: http://code.djangoproject.com/svn/django/branches/magic-removal@2029 bcc190cf-cafb-0310-a4f2-bffc1f526a37
This commit is contained in:
Russell Keith-Magee
2006-01-17 12:06:16 +00:00
parent d9780b7bd5
commit 00f93bc7bb
3 changed files with 39 additions and 9 deletions

View File

@@ -203,6 +203,13 @@ Traceback (most recent call last):
...
AttributeError: Manager isn't accessible via Article instances
# Bulk delete test: How many objects before and after the delete?
>>> Article.objects.get_count()
8L
>>> Article.objects.delete(id__lte=4)
>>> Article.objects.get_count()
4L
"""
from django.conf import settings

View File

@@ -83,7 +83,7 @@ This is a test
[This is a test, John's second story]
# The underlying query only makes one join when a related table is referenced twice.
>>> null, sql, null = Article.objects._get_sql_clause(reporter__first_name__exact='John', reporter__last_name__exact='Smith')
>>> null, sql, null = Article.objects._get_sql_clause(True, reporter__first_name__exact='John', reporter__last_name__exact='Smith')
>>> sql.count('INNER JOIN')
1
@@ -152,4 +152,9 @@ John Smith
>>> Reporter.objects.get_list(articles__reporter__first_name__startswith='John', distinct=True)
[John Smith]
# Delete requiring join is prohibited
>>> Article.objects.delete(reporter__first_name__startswith='Jo')
Traceback (most recent call last):
...
TypeError: Joins are not allowed in this type of query
"""