1
0
mirror of https://github.com/netbox-community/netbox.git synced 2024-05-10 07:54:54 +00:00

Fix tag background color

This commit is contained in:
jeremystretch
2022-02-22 13:10:04 -05:00
parent 7872460162
commit 6604ebfd01
2 changed files with 3 additions and 3 deletions

View File

@ -217,7 +217,7 @@ class ChoiceFieldColumn(tables.Column):
# Determine the background color to use (try calling object.get_FOO_color())
try:
bg_color = getattr(record, f'get_{bound_column.name}_color')()
bg_color = getattr(record, f'get_{bound_column.name}_color')() or self.DEFAULT_BG_COLOR
except AttributeError:
bg_color = self.DEFAULT_BG_COLOR

View File

@ -19,7 +19,7 @@ def tag(value, viewname=None):
@register.inclusion_tag('builtins/badge.html')
def badge(value, bg_color='secondary', show_empty=False):
def badge(value, bg_color=None, show_empty=False):
"""
Display the specified number as a badge.
@ -30,7 +30,7 @@ def badge(value, bg_color='secondary', show_empty=False):
"""
return {
'value': value,
'bg_color': bg_color,
'bg_color': bg_color or 'secondary',
'show_empty': show_empty,
}