How do I perform a Django queryset filter looking for blank files in FileField fields?
The field isn’t null, it has a FileObject in it that doesn’t have a file.
Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.
Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.
Lost your password? Please enter your email address. You will receive a link and will create a new password via email.
Please briefly explain why you feel this question should be reported.
Please briefly explain why you feel this answer should be reported.
Please briefly explain why you feel this user should be reported.
I was having this issue too, and finally found the solution!
This works because internally, the
FileFieldis represented as a local file path in aCharField, and Django stores non-files as an empty string''in the database.