mirror of
https://github.com/netbox-community/netbox.git
synced 2025-07-21 11:37:21 -06:00
Fix tag background color
This commit is contained in:
parent
7872460162
commit
6604ebfd01
@ -217,7 +217,7 @@ class ChoiceFieldColumn(tables.Column):
|
|||||||
|
|
||||||
# Determine the background color to use (try calling object.get_FOO_color())
|
# Determine the background color to use (try calling object.get_FOO_color())
|
||||||
try:
|
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:
|
except AttributeError:
|
||||||
bg_color = self.DEFAULT_BG_COLOR
|
bg_color = self.DEFAULT_BG_COLOR
|
||||||
|
|
||||||
|
@ -19,7 +19,7 @@ def tag(value, viewname=None):
|
|||||||
|
|
||||||
|
|
||||||
@register.inclusion_tag('builtins/badge.html')
|
@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.
|
Display the specified number as a badge.
|
||||||
|
|
||||||
@ -30,7 +30,7 @@ def badge(value, bg_color='secondary', show_empty=False):
|
|||||||
"""
|
"""
|
||||||
return {
|
return {
|
||||||
'value': value,
|
'value': value,
|
||||||
'bg_color': bg_color,
|
'bg_color': bg_color or 'secondary',
|
||||||
'show_empty': show_empty,
|
'show_empty': show_empty,
|
||||||
}
|
}
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user