I've ran into this when digging around, trying to add an "accept" parameter to the underlying <input type="file"/> tag to restrict file type choice in the picker dialog. I've started by forking the template and adding {% include "django/forms/widgets/attrs.html" %}, as is used in the base input widget template.
Turns out widget is missing from the template context, and the context itself is supplied inline in S3DirectWidget's render method, ignoring get_context on the base class and not allowing an override in a subclass.
I realise the widget parameter in this template context would be quite ambiguous, considering that this is a composite widget with very specific behaviour defined indirectly via frontend and settings, but I think it would be beneficial under the "I know what I'm doing, please let me write less code" circumstances - I can prepare a PR to address this.
I've ran into this when digging around, trying to add an "accept" parameter to the underlying
<input type="file"/>
tag to restrict file type choice in the picker dialog. I've started by forking the template and adding{% include "django/forms/widgets/attrs.html" %}
, as is used in the base input widget template.Turns out
widget
is missing from the template context, and the context itself is supplied inline in S3DirectWidget'srender
method, ignoringget_context
on the base class and not allowing an override in a subclass.I realise the
widget
parameter in this template context would be quite ambiguous, considering that this is a composite widget with very specific behaviour defined indirectly via frontend and settings, but I think it would be beneficial under the "I know what I'm doing, please let me write less code" circumstances - I can prepare a PR to address this.