How to not render django image field currently and clear stuff?

前端 未结 3 1431
我寻月下人不归
我寻月下人不归 2021-02-01 05:04

I took a look at following SO question, but had no luck. I don\'t know, maybe I didn\'t understand the answers.

1) How to remove the “Currently” tag and link of a FileIn

3条回答
  •  Happy的楠姐
    2021-02-01 05:13

    You can change the widget used to render the form field by specifying it on initializing:

    class SettingsForm(forms.ModelForm):
        company_logo = forms.ImageField(label=_('Company Logo'),required=False, \
                                        error_messages ={'invalid':_("Image files only")},\
                                        widget=FileInput)
    

    See the docs for widgets.

提交回复
热议问题