diff options
| author | Karen Tracey <kmtracey@gmail.com> | 2011-05-22 15:51:22 +0000 |
|---|---|---|
| committer | Karen Tracey <kmtracey@gmail.com> | 2011-05-22 15:51:22 +0000 |
| commit | 909e002808135ee943643e6b1866e9aa5cb0b42d (patch) | |
| tree | b99258a70edcb62f79254e5b06a471da11213c59 /tests | |
| parent | d95355b6db0a457130bce22bb1dbf1a48731dfc6 (diff) | |
Fix UnboundLocalError than could occur during ModelAdmin validation.
git-svn-id: http://code.djangoproject.com/svn/django/trunk@16262 bcc190cf-cafb-0310-a4f2-bffc1f526a37
Diffstat (limited to 'tests')
| -rw-r--r-- | tests/regressiontests/admin_validation/tests.py | 16 |
1 files changed, 16 insertions, 0 deletions
diff --git a/tests/regressiontests/admin_validation/tests.py b/tests/regressiontests/admin_validation/tests.py index a80820cb67..2cf3c60062 100644 --- a/tests/regressiontests/admin_validation/tests.py +++ b/tests/regressiontests/admin_validation/tests.py @@ -256,3 +256,19 @@ class ValidationTestCase(TestCase): fields = ['title', 'extra_data'] validate(FieldsOnFormOnlyAdmin, Song) + + def test_non_model_first_field(self): + """ + Regression for ensuring ModelAdmin.field can handle first elem being a + non-model field (test fix for UnboundLocalError introduced with r16225). + """ + class SongForm(forms.ModelForm): + extra_data = forms.CharField() + class Meta: + model = Song + + class FieldsOnFormOnlyAdmin(admin.ModelAdmin): + form = SongForm + fields = ['extra_data', 'title'] + + validate(FieldsOnFormOnlyAdmin, Song) |
