diff --git a/pyuploadcare/dj/forms.py b/pyuploadcare/dj/forms.py index 5c00938b..d285018b 100644 --- a/pyuploadcare/dj/forms.py +++ b/pyuploadcare/dj/forms.py @@ -58,7 +58,7 @@ def __init__(self, attrs=None): self._client = get_uploadcare_client() super(FileWidget, self).__init__(attrs) - def render(self, name, value, attrs=None, renderer=None): + def _widget_config(self, attrs=None): config = { "multiple": False, } @@ -81,6 +81,10 @@ def render(self, name, value, attrs=None, renderer=None): if k not in ["class"] } + return config + + def render(self, name, value, attrs=None, renderer=None): + uploadcare_js = dj_conf.uploadcare_js uploadcare_css = dj_conf.uploadcare_css @@ -90,6 +94,8 @@ def render(self, name, value, attrs=None, renderer=None): if not urlparse(uploadcare_css).netloc: uploadcare_css = static(uploadcare_css) + config = self._widget_config(attrs=attrs) + return render_to_string( "uploadcare/forms/widgets/file.html", {