Skip to content

Commit

Permalink
Merge pull request #553 from haakenlid/patch-2
Browse files Browse the repository at this point in the history
 Fix #554: Fix AdminImageWidget with Django 2.1
  • Loading branch information
matthiask committed Sep 13, 2018
2 parents 44fd90f + d74d8cb commit dacedfe
Show file tree
Hide file tree
Showing 2 changed files with 12 additions and 2 deletions.
4 changes: 2 additions & 2 deletions sorl/thumbnail/admin/current.py
Expand Up @@ -22,8 +22,8 @@ class AdminImageWidget(forms.ClearableFileInput):
)
template_with_clear = '<label>%(clear_checkbox_label)s: %(clear)s</label>'

def render(self, name, value, attrs=None):
output = super(AdminImageWidget, self).render(name, value, attrs)
def render(self, name, value, attrs=None, **kwargs):
output = super(AdminImageWidget, self).render(name, value, attrs, **kwargs)
if value and hasattr(value, 'url'):
ext = 'JPEG'
try:
Expand Down
10 changes: 10 additions & 0 deletions tests/thumbnail_tests/test_admin.py
@@ -0,0 +1,10 @@
from django.test import SimpleTestCase
from django.test.utils import override_settings

from sorl.thumbnail.admin.current import AdminImageWidget


class AdminImageWidgetTests(SimpleTestCase):
def test_render_renderer_argument(self):
w = AdminImageWidget()
self.assertHTMLEqual(w.render('name', 'value', renderer=None), '<input type="file" name="name">')

0 comments on commit dacedfe

Please sign in to comment.