Skip to content

Commit 282dc7a

Browse files
committed
Fixes #15608: Avoid caching values of null fields in search index
1 parent e1753c0 commit 282dc7a

File tree

1 file changed

+3
-2
lines changed

1 file changed

+3
-2
lines changed

netbox/netbox/search/__init__.py

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -59,9 +59,10 @@ def get_field_type(instance, field_name):
5959
@staticmethod
6060
def get_field_value(instance, field_name):
6161
"""
62-
Return the value of the specified model field as a string.
62+
Return the value of the specified model field as a string (or None).
6363
"""
64-
return str(getattr(instance, field_name))
64+
if value := getattr(instance, field_name):
65+
return str(value)
6566

6667
@classmethod
6768
def get_category(cls):

0 commit comments

Comments
 (0)