summaryrefslogtreecommitdiff
path: root/tests
diff options
context:
space:
mode:
authorRussell Keith-Magee <russell@keith-magee.com>2010-03-27 15:16:27 +0000
committerRussell Keith-Magee <russell@keith-magee.com>2010-03-27 15:16:27 +0000
commitb31b2d4da3772463d007c9d986c4bdd1392b09e7 (patch)
tree556f56c342904d12dc79a7f167225eb6accc7c4b /tests
parent5256a805ff1c31e4d5112627846291e91c5dc65d (diff)
Fixed #13227 -- Modified ForeignKeys to fully honor the db_prep/prep separation introduced by multidb. This was required to ensure that model instances aren't deepcopied as a result of being involved in a filter clause. Thanks to claudep for the report, and Alex Gaynor for the help on the patch.
git-svn-id: http://code.djangoproject.com/svn/django/trunk@12865 bcc190cf-cafb-0310-a4f2-bffc1f526a37
Diffstat (limited to 'tests')
-rw-r--r--tests/regressiontests/queries/models.py8
1 files changed, 8 insertions, 0 deletions
diff --git a/tests/regressiontests/queries/models.py b/tests/regressiontests/queries/models.py
index 69d990eb7f..65b0be419d 100644
--- a/tests/regressiontests/queries/models.py
+++ b/tests/regressiontests/queries/models.py
@@ -5,6 +5,7 @@ Various complex queries that have been problematic in the past.
import datetime
import pickle
import sys
+import threading
from django.conf import settings
from django.db import models, DEFAULT_DB_ALIAS
@@ -45,6 +46,13 @@ class Note(models.Model):
def __unicode__(self):
return self.note
+ def __init__(self, *args, **kwargs):
+ super(Note, self).__init__(*args, **kwargs)
+ # Regression for #13227 -- having an attribute that
+ # is unpickleable doesn't stop you from cloning queries
+ # that use objects of that type as an argument.
+ self.lock = threading.Lock()
+
class Annotation(models.Model):
name = models.CharField(max_length=10)
tag = models.ForeignKey(Tag)