Issue
forms.py:
class ImportExcelForm(Form):
file = forms.FileField(attrs={'class':'rounded_list',})
I'm trying to add css class to my filefield
in forms.I am getting this error "__init__() got an unexpected keyword argument 'attrs'"
What did I do wrong?
Thanks.
Solution
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.
Answered By - Daniel Roseman
0 comments:
Post a Comment
Note: Only a member of this blog may post a comment.