Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with HTTPS or Subversion.

Download ZIP
Browse files

Added a test to demonstrate the remaining problem in #7095.

Only fails for MySQL (because they've made some interesting syntax choices).
Refs #7095.


git-svn-id: http://code.djangoproject.com/svn/django/trunk@7495 bcc190cf-cafb-0310-a4f2-bffc1f526a37
  • Loading branch information...
commit ff6e529502976b24906dd59636c3795218c6d708 1 parent 1bb8260
@malcolmt malcolmt authored
Showing with 24 additions and 0 deletions.
  1. +24 −0 tests/regressiontests/queries/models.py
View
24 tests/regressiontests/queries/models.py
@@ -117,6 +117,24 @@ class LoopZ(models.Model):
class Meta:
ordering = ['z']
+# A model and custom default manager combination.
+class CustomManager(models.Manager):
+ def get_query_set(self):
+ return super(CustomManager, self).get_query_set().filter(public=True,
+ tag__name='t1')
+
+class ManagedModel(models.Model):
+ data = models.CharField(max_length=10)
+ tag = models.ForeignKey(Tag)
+ public = models.BooleanField(default=True)
+
+ objects = CustomManager()
+ normal_manager = models.Manager()
+
+ def __unicode__(self):
+ return self.data
+
+
__test__ = {'API_TESTS':"""
>>> t1 = Tag(name='t1')
>>> t1.save()
@@ -677,5 +695,11 @@ class Meta:
>>> Item.objects.exclude(~Q(tags__name='t1', name='one'), name='two')
[<Item: four>, <Item: one>, <Item: three>]
+Bug #7095
+Updates that are filtered on the model being updated are somewhat tricky to get
+in MySQL. This exercises that case.
+>>> mm = ManagedModel.objects.create(data='mm1', tag=t1, public=True)
+>>> ManagedModel.objects.update(data='mm')
+
"""}
Please sign in to comment.
Something went wrong with that request. Please try again.