Django: any way to remove this field?

Is there any way to remove the form field of the "clear" form file? I know that I can define a “custom” widget for a file field, but how to set this checkbox in this?enter image description here

+5
source share
3 answers

You need to change the widget from ClearableFileInput to Fileinput https://docs.djangoproject.com/en/dev/ref/forms/widgets/#fileinput

+6
source

Adding to @schacki's answer. Here's how to use a simpler widget FileInput:

# forms.py
from django.forms.widgets import FileInput

class SomeForm(forms.Form):
    foofile = forms.FileField(widget=FileInput)

The default widget for FileField looks like ClearableFileInput.

+3
source

ImageField , {{ imagefieldname }}, , - HTML, Django .

"" HTML, Django, , .

+1
source

All Articles