mirror of
https://github.com/django/django.git
synced 2025-10-24 06:06:09 +00:00
[3.1.x] Fixed #31536 -- Fixed rendering of disabled AdminFileWidget and ClearableFileInput.
Backport of e46c2326c8 from master
This commit is contained in:
committed by
Mariusz Felisiak
parent
22dac456f3
commit
56af541790
@@ -487,6 +487,20 @@ class AdminFileWidgetTests(TestDataMixin, TestCase):
|
||||
},
|
||||
)
|
||||
|
||||
def test_render_disabled(self):
|
||||
widget = widgets.AdminFileWidget(attrs={'disabled': True})
|
||||
self.assertHTMLEqual(
|
||||
widget.render('test', self.album.cover_art),
|
||||
'<p class="file-upload">Currently: <a href="%(STORAGE_URL)salbums/'
|
||||
r'hybrid_theory.jpg">albums\hybrid_theory.jpg</a> '
|
||||
'<span class="clearable-file-input">'
|
||||
'<input type="checkbox" name="test-clear" id="test-clear_id" disabled>'
|
||||
'<label for="test-clear_id">Clear</label></span><br>'
|
||||
'Change: <input type="file" name="test" disabled></p>' % {
|
||||
'STORAGE_URL': default_storage.url(''),
|
||||
},
|
||||
)
|
||||
|
||||
def test_readonly_fields(self):
|
||||
"""
|
||||
File widgets should render as a link when they're marked "read only."
|
||||
|
||||
Reference in New Issue
Block a user