summaryrefslogtreecommitdiff
path: root/django/db
diff options
context:
space:
mode:
authorVIZZARD-X <vigneshanandmay13@gmail.com>2025-11-26 14:06:20 +0530
committerSarah Boyce <42296566+sarahboyce@users.noreply.github.com>2026-04-14 14:32:08 +0300
commit3157285e27a426530ef571855e0e29c317e210df (patch)
tree90f58a2e72a2541fbbeb90909daa57fea5f37491 /django/db
parent8d326336c5fba4740114fea5294a7b426c96d65c (diff)
Fixed #27150 -- Made base File objects truthy by default.
Diffstat (limited to 'django/db')
-rw-r--r--django/db/models/fields/files.py3
1 files changed, 3 insertions, 0 deletions
diff --git a/django/db/models/fields/files.py b/django/db/models/fields/files.py
index dbf227ae92..dc32e0d209 100644
--- a/django/db/models/fields/files.py
+++ b/django/db/models/fields/files.py
@@ -34,6 +34,9 @@ class FieldFile(File, AltersData):
def __hash__(self):
return hash(self.name)
+ def __bool__(self):
+ return bool(self.name)
+
# The standard File contains most of the necessary properties, but
# FieldFiles can be instantiated without a name, so that needs to
# be checked for here.