Hi,
Is it possible to mark a FileField in my model as required
My model looks like :
class FileUpload(models.Model):
owner = models.CharField(max_length=200,blank=False, null=False)
record = models.FileField(upload_to=path_and_rename,blank=False, null=False)
1st statement :
According to what i have read the blank and null parameter are not necessary
and only the parameter "upload_to" and "storage" are availables
2nd statement :
Secondly, it seems that the field validation are done at the form level or serializer level.
I would like to know if these 2 statements are true?
when I use python manage.py shell and make a test of creating a FileUpload object and save it, i dont get any error saying the that filefield is required :
## steps :
test = FileUpload(owner="test")
test.save()
## expected :
Error : filefield "record" is required!
## actual behavior :
save the object without error
Is it possible to put the filefield as required at the model level?
or
Do i have to make the validation of the field before/at an upper level?
Thank you
Cyril