Skip to content

Commit

Permalink
Fixes #15608: Avoid caching values of null fields in search index
Browse files Browse the repository at this point in the history
  • Loading branch information
jeremystretch committed Apr 3, 2024
1 parent 24e2fc2 commit 8a713de
Showing 1 changed file with 3 additions and 2 deletions.
5 changes: 3 additions & 2 deletions netbox/netbox/search/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -59,9 +59,10 @@ def get_field_type(instance, field_name):
@staticmethod
def get_field_value(instance, field_name):
"""
Return the value of the specified model field as a string.
Return the value of the specified model field as a string (or None).
"""
return str(getattr(instance, field_name))
if value := getattr(instance, field_name):
return str(value)

@classmethod
def get_category(cls):
Expand Down

0 comments on commit 8a713de

Please sign in to comment.