Author: mtredinnick
Date: 2011-08-23 20:51:33 -0700 (Tue, 23 Aug 2011)
New Revision: 16679

Modified:
   django/trunk/tests/modeltests/m2m_and_m2o/models.py
   django/trunk/tests/modeltests/m2m_and_m2o/tests.py
Log:
Added another test to confirm fix in r16663.

This is the test case from #6045, which was fixed by the above commit.
Refs #6045, #16299

Modified: django/trunk/tests/modeltests/m2m_and_m2o/models.py
===================================================================
--- django/trunk/tests/modeltests/m2m_and_m2o/models.py 2011-08-23 23:43:29 UTC 
(rev 16678)
+++ django/trunk/tests/modeltests/m2m_and_m2o/models.py 2011-08-24 03:51:33 UTC 
(rev 16679)
@@ -19,3 +19,7 @@
 
     class Meta:
         ordering = ('num',)
+
+class UnicodeReferenceModel(models.Model): 
+    others = models.ManyToManyField(u"UnicodeReferenceModel") 
+

Modified: django/trunk/tests/modeltests/m2m_and_m2o/tests.py
===================================================================
--- django/trunk/tests/modeltests/m2m_and_m2o/tests.py  2011-08-23 23:43:29 UTC 
(rev 16678)
+++ django/trunk/tests/modeltests/m2m_and_m2o/tests.py  2011-08-24 03:51:33 UTC 
(rev 16679)
@@ -1,7 +1,7 @@
 from django.db.models import Q
 from django.test import TestCase
 
-from models import Issue, User
+from models import Issue, User, UnicodeReferenceModel
 
 
 class RelatedObjectTests(TestCase):
@@ -73,3 +73,16 @@
             ],
             lambda i: i.num
         )
+
+class RelatedObjectTests(TestCase): 
+    def test_m2m_with_unicode_reference(self): 
+        """
+        Regression test for #6045: references to other models can be unicode
+        strings, providing they are directly convertible to ASCII.
+        """
+        m1=UnicodeReferenceModel.objects.create() 
+        m2=UnicodeReferenceModel.objects.create() 
+        m2.others.add(m1) # used to cause an error (see ticket #6045) 
+        m2.save() 
+        list(m2.others.all()) # Force retrieval.
+

-- 
You received this message because you are subscribed to the Google Groups 
"Django updates" group.
To post to this group, send email to [email protected].
To unsubscribe from this group, send email to 
[email protected].
For more options, visit this group at 
http://groups.google.com/group/django-updates?hl=en.

Reply via email to