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:
@ -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
|
||||
|
||||
|
@ -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,
|
||||
}
|
||||
|
||||
|
Reference in New Issue
Block a user