2👍
✅
You can change this with the widget attrs
as documented here: https://docs.djangoproject.com/en/1.3/ref/forms/widgets/#django.forms.Widget.attrs
from django import forms
class MyForm(forms.Form):
my_file = forms.FileField()
def __init__(self, *args, **kwargs):
super(MyForm, self).__init__(*args, **kwargs)
self.fields['my_file'].widget.attrs.update({'accept': 'image/*'})
Or you can use something like django-widget-tweaks to do this with a templatetag.
Source:stackexchange.com