3👍
✅
Yes, it is definitely possible, so check if you have required=False.
Quoting from documentation for django 1.4: “By default, each Field class assumes the value is required, so if you pass an empty value — either None or the empty string (“”) — then clean() will raise a ValidationError exception:” ( https://docs.djangoproject.com/en/1.4/ref/forms/fields/#required )
1👍
Given that you are basing your form on a model, what you want is Field.blank
– this allows a field to be blank. (Potentially you will also want Field.null
too, which allows a blank value to be recorded as null
in the database).
x = FileField(..., blank=True, null=True)
- [Django]-How can I set arbitrary attributes on Django Model Fields, then access them in a ModelForm?
- [Django]-Getting None values for POST request (via the Axios library) sent to Python/Django
- [Django]-Can I run a background process in Django without starting a parallel process?
- [Django]-How do I prevent Django from interpreting a block which contains curly quotes?
- [Django]-Django Channels 2.0 channel_layers not communicating
- [Django]-What's the best way to handle different forms from a single page in Django?
- [Django]-Django how to open file in FileField
- [Django]-Need xhtml2pdf (Pisa 3.0) css syntax for @page and @frame
- [Django]-Django-environ dictionary format
Source:stackexchange.com