Django - how to make ImageField/FileField optional?
- by ilya
class Product(models.Model):
...
image = models.ImageField(upload_to = generate_filename, blank = True)
When I use ImageField (blank=True) and do not select image into admin form, exception occures.
In django code you can see this:
class FieldFile(File):
....
def _require_file(self):
if not self:
raise…