DEV Community

Jaweher Ben Salah
Jaweher Ben Salah

Posted on

Answer: __init__() got an unexpected keyword argument 'attrs'

attrs is not an argument to the field, it's an argument to the widget.

file = forms.FileField(widget=forms.FileInput(attrs={'class': 'rounded_list'}))

Note that some browsers don't allow styling of the file input.

Top comments (0)