summaryrefslogtreecommitdiff
path: root/tests
diff options
context:
space:
mode:
authorMalcolm Tredinnick <malcolm.tredinnick@gmail.com>2008-06-26 10:50:25 +0000
committerMalcolm Tredinnick <malcolm.tredinnick@gmail.com>2008-06-26 10:50:25 +0000
commit0e692fda9ca57909216e68a998f2752885c23725 (patch)
treecab10a27c06b5b6e39c8d15a66d2594df0d31ebf /tests
parent279fc8599b72d56729871f241d6e91dc2d409158 (diff)
Fixed the way symmetrical many-to-many relations are recorded in the Options class.
These types of relations don't have reverse accessor names, so that name can be used by a normal field on the model. Fixed #7107. git-svn-id: http://code.djangoproject.com/svn/django/trunk@7764 bcc190cf-cafb-0310-a4f2-bffc1f526a37
Diffstat (limited to 'tests')
-rw-r--r--tests/regressiontests/queries/models.py13
1 files changed, 13 insertions, 0 deletions
diff --git a/tests/regressiontests/queries/models.py b/tests/regressiontests/queries/models.py
index a3e5561b86..cfbaf773d6 100644
--- a/tests/regressiontests/queries/models.py
+++ b/tests/regressiontests/queries/models.py
@@ -90,6 +90,15 @@ class Number(models.Model):
def __unicode__(self):
return unicode(self.num)
+# Symmetrical m2m field with a normal field using the reverse accesor name
+# ("valid").
+class Valid(models.Model):
+ valid = models.CharField(max_length=10)
+ parent = models.ManyToManyField('self')
+
+ class Meta:
+ ordering = ['valid']
+
# Some funky cross-linked models for testing a couple of infinite recursion
# cases.
class X(models.Model):
@@ -768,5 +777,9 @@ just count the number of results).
>>> len(Tag.objects.order_by('parent__name'))
5
+Bug #7107 -- this shouldn't create an infinite loop.
+>>> Valid.objects.all()
+[]
+
"""}