If you're using a forms.FileField()
in a forms.Form
derived class, you can set:
class form(forms.Form):
file = forms.FileField(required=False)
If you're using a models.FileField()
and have a forms.ModelForm
assigned to that model, you can use
class amodel(models.Model):
file = models.FileField(blank=True, null=True)
Which you use depends on how you are deriving the form and if you are using the underlying ORM (i.e. a model).
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With