diff options
Diffstat (limited to 'tests/model_forms/tests.py')
| -rw-r--r-- | tests/model_forms/tests.py | 13 |
1 files changed, 13 insertions, 0 deletions
diff --git a/tests/model_forms/tests.py b/tests/model_forms/tests.py index 80dcf43be7..98b9c1ad52 100644 --- a/tests/model_forms/tests.py +++ b/tests/model_forms/tests.py @@ -1885,6 +1885,19 @@ class FileAndImageFieldTests(TestCase): self.assertIn('something.txt', rendered) self.assertIn('myfile-clear', rendered) + def test_render_empty_file_field(self): + class DocumentForm(forms.ModelForm): + class Meta: + model = Document + fields = '__all__' + + doc = Document.objects.create() + form = DocumentForm(instance=doc) + self.assertEqual( + str(form['myfile']), + '<input id="id_myfile" name="myfile" type="file" />' + ) + def test_file_field_data(self): # Test conditions when files is either not given or empty. f = TextFileForm(data={'description': 'Assistance'}) |
