diff options
| author | Luke Plant <L.Plant.98@cantab.net> | 2010-03-08 23:55:04 +0000 |
|---|---|---|
| committer | Luke Plant <L.Plant.98@cantab.net> | 2010-03-08 23:55:04 +0000 |
| commit | 48cd8e856fa027e0e699e5a5ed7e3eb8f8450abb (patch) | |
| tree | 41b315b426735f7220c5a8edab7e36c10be9b9ef /tests/regressiontests/model_forms_regress/tests.py | |
| parent | 960af90279081e7a4121736f3f2bc67077f11b31 (diff) | |
Fixed #11183 - BaseForm init leaves pointers pointing back to base_fields
Thanks to margieroginski for the report
git-svn-id: http://code.djangoproject.com/svn/django/trunk@12733 bcc190cf-cafb-0310-a4f2-bffc1f526a37
Diffstat (limited to 'tests/regressiontests/model_forms_regress/tests.py')
| -rw-r--r-- | tests/regressiontests/model_forms_regress/tests.py | 15 |
1 files changed, 14 insertions, 1 deletions
diff --git a/tests/regressiontests/model_forms_regress/tests.py b/tests/regressiontests/model_forms_regress/tests.py index 3d3a103a58..5a7a83bc0e 100644 --- a/tests/regressiontests/model_forms_regress/tests.py +++ b/tests/regressiontests/model_forms_regress/tests.py @@ -2,7 +2,7 @@ from datetime import date from django import db from django import forms -from django.forms.models import modelform_factory +from django.forms.models import modelform_factory, ModelChoiceField from django.conf import settings from django.test import TestCase @@ -203,3 +203,16 @@ class OneToOneFieldTests(TestCase): form = AuthorForm({'publication':u'', 'full_name':'John Doe'}, instance=author) self.assert_(not form.is_valid()) + +class ModelChoiceForm(forms.Form): + person = ModelChoiceField(Person.objects.all()) + + +class TestTicket11183(TestCase): + def test_11183(self): + form1 = ModelChoiceForm() + field1 = form1.fields['person'] + # To allow the widget to change the queryset of field1.widget.choices correctly, + # without affecting other forms, the following must hold: + self.assert_(field1 is not ModelChoiceForm.base_fields['person']) + self.assert_(field1.widget.choices.field is field1) |
