[Django]-Django FileField not saving to upload_to location

0👍

The test can be made to pass if I change the Attachment model’s attachment_file field to not allow blanks or nulls.

Specifically change

attachment_file = models.FileField(blank=True,null=True,upload_to=upload_to)

to

attachment_file = models.FileField(blank=False,null=False,upload_to=upload_to)

I don’t know why this makes a difference in my test and would love an explanation from a Django guru. Why won’t FileField save a file without these parameters being False?

👤Erik

Leave a comment