summaryrefslogtreecommitdiff
path: root/tests/regressiontests/model_forms_regress
diff options
context:
space:
mode:
authorKaren Tracey <kmtracey@gmail.com>2009-12-13 17:46:52 +0000
committerKaren Tracey <kmtracey@gmail.com>2009-12-13 17:46:52 +0000
commit125403ca972d4964691ee206acc6c28c0b3eab9d (patch)
tree948c0f1a54423ec91b90c73e81047482d70a015f /tests/regressiontests/model_forms_regress
parent6a7db77e957ab00445982484e553a65dc691604a (diff)
Fixed #12215: Added len to ModelChoiceIterator. Thanks Alex and Tobias.
git-svn-id: http://code.djangoproject.com/svn/django/trunk@11850 bcc190cf-cafb-0310-a4f2-bffc1f526a37
Diffstat (limited to 'tests/regressiontests/model_forms_regress')
-rw-r--r--tests/regressiontests/model_forms_regress/tests.py14
1 files changed, 13 insertions, 1 deletions
diff --git a/tests/regressiontests/model_forms_regress/tests.py b/tests/regressiontests/model_forms_regress/tests.py
index 85e284b639..f8b6511140 100644
--- a/tests/regressiontests/model_forms_regress/tests.py
+++ b/tests/regressiontests/model_forms_regress/tests.py
@@ -100,4 +100,16 @@ class CustomFieldSaveTests(TestCase):
# It's enough that the form saves without error -- the custom save routine will
# generate an AssertionError if it is called more than once during save.
form = CFFForm(data = {'f': None})
- form.save() \ No newline at end of file
+ form.save()
+
+class ModelChoiceIteratorTests(TestCase):
+ def test_len(self):
+ class Form(forms.ModelForm):
+ class Meta:
+ model = Article
+ fields = ["publications"]
+
+ Publication.objects.create(title="Pravda",
+ date_published=date(1991, 8, 22))
+ f = Form()
+ self.assertEqual(len(f.fields["publications"].choices), 1)