如何修改FileField“浏览”按钮属性(字体,颜色,大小等)

时间:2012-04-30 17:15:39

标签: python django django-forms

我想更改FileField的默认“浏览”按钮的大小,字体颜色和字体大小。以下代码无效:

class SubmitForm(forms.Form):
    uploadedfile = forms.FileField(required=True, label='File to upload:')

    def __init__(self, *args, **kwargs):
        super(SubmitForm, self).__init__(*args, **kwargs)
        self.fields['uploadedfile'].widget.attrs['style'] = 'width: 280px; size: 100px;'

您对如何做到这一点有什么想法吗?提前谢谢!

0 个答案:

没有答案