Author: jacob
Date: 2009-04-03 15:04:39 -0500 (Fri, 03 Apr 2009)
New Revision: 10376

Modified:
   django/branches/releases/1.0.X/django/contrib/contenttypes/generic.py
   
django/branches/releases/1.0.X/tests/regressiontests/generic_inline_admin/tests.py
Log:
[1.0.X] Fixed #10522: accept tuples in `generic_inlineformset_factor(exclude)`. 
Thanks, mk. Backport of r10375 from trunk.

Modified: django/branches/releases/1.0.X/django/contrib/contenttypes/generic.py
===================================================================
--- django/branches/releases/1.0.X/django/contrib/contenttypes/generic.py       
2009-04-03 20:03:46 UTC (rev 10375)
+++ django/branches/releases/1.0.X/django/contrib/contenttypes/generic.py       
2009-04-03 20:04:39 UTC (rev 10376)
@@ -355,6 +355,7 @@
         raise Exception("fk_name '%s' is not a ForeignKey to ContentType" % 
ct_field)
     fk_field = opts.get_field(fk_field) # let the exception propagate
     if exclude is not None:
+        exclude = list(exclude)
         exclude.extend([ct_field.name, fk_field.name])
     else:
         exclude = [ct_field.name, fk_field.name]

Modified: 
django/branches/releases/1.0.X/tests/regressiontests/generic_inline_admin/tests.py
===================================================================
--- 
django/branches/releases/1.0.X/tests/regressiontests/generic_inline_admin/tests.py
  2009-04-03 20:03:46 UTC (rev 10375)
+++ 
django/branches/releases/1.0.X/tests/regressiontests/generic_inline_admin/tests.py
  2009-04-03 20:04:39 UTC (rev 10376)
@@ -2,6 +2,7 @@
 
 from django.test import TestCase
 from django.conf import settings
+from django.contrib.contenttypes.generic import generic_inlineformset_factory
 
 # local test models
 from models import Episode, Media
@@ -71,3 +72,8 @@
         }
         response = 
self.client.post('/generic_inline_admin/admin/generic_inline_admin/episode/1/', 
post_data)
         self.failUnlessEqual(response.status_code, 302) # redirect somewhere
+    
+    def testGenericInlineFormsetFactory(self):
+        # Regression test for #10522.
+        inline_formset = generic_inlineformset_factory(Media,
+            exclude=('url',))


--~--~---------~--~----~------------~-------~--~----~
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