From b5f92938abd64f5577eea9f80925d71bc7968c09 Mon Sep 17 00:00:00 2001 From: Jacob Kaplan-Moss Date: Mon, 9 Jun 2008 16:17:54 +0000 Subject: Fixed #7298: prevent update() on sliced QuerySet since UPDATE doesn't reliably support LIMIT/OFFSET. Thanks, George Vilches. git-svn-id: http://code.djangoproject.com/svn/django/trunk@7601 bcc190cf-cafb-0310-a4f2-bffc1f526a37 --- tests/modeltests/update/models.py | 7 +++++++ 1 file changed, 7 insertions(+) (limited to 'tests') diff --git a/tests/modeltests/update/models.py b/tests/modeltests/update/models.py index 3b0f83389f..8a35b61a7c 100644 --- a/tests/modeltests/update/models.py +++ b/tests/modeltests/update/models.py @@ -63,5 +63,12 @@ a manager method. >>> DataPoint.objects.values('value').distinct() [{'value': u'thing'}] +We do not support update on already sliced query sets. + +>>> DataPoint.objects.all()[:2].update(another_value='another thing') +Traceback (most recent call last): + ... +AssertionError: Cannot update a query once a slice has been taken. + """ } -- cgit v1.3