From 90b423812c5d3a974fe8609a2f0d9d0536975f74 Mon Sep 17 00:00:00 2001 From: Arthur Hanson Date: Tue, 27 Aug 2024 09:00:16 -0700 Subject: [PATCH] 17186 change choice to default --- netbox/extras/migrations/0116_custom_link_button_color.py | 2 +- netbox/extras/templatetags/custom_links.py | 7 ++++++- netbox/netbox/choices.py | 2 +- 3 files changed, 8 insertions(+), 3 deletions(-) diff --git a/netbox/extras/migrations/0116_custom_link_button_color.py b/netbox/extras/migrations/0116_custom_link_button_color.py index f90437372..5910cdcef 100644 --- a/netbox/extras/migrations/0116_custom_link_button_color.py +++ b/netbox/extras/migrations/0116_custom_link_button_color.py @@ -18,7 +18,7 @@ class Migration(migrations.Migration): migrations.AlterField( model_name='customlink', name='button_class', - field=models.CharField(default='outline-secondary', max_length=30), + field=models.CharField(default='default', max_length=30), ), migrations.RunPython( code=update_link_buttons, diff --git a/netbox/extras/templatetags/custom_links.py b/netbox/extras/templatetags/custom_links.py index dd28a8160..a961c4ea7 100644 --- a/netbox/extras/templatetags/custom_links.py +++ b/netbox/extras/templatetags/custom_links.py @@ -61,8 +61,13 @@ def custom_links(context, obj): else: try: if rendered := cl.render(link_context): + if cl.button_class == "default": + button_class = 'outline-secondary' + else: + button_class = cl.button_class + template_code += LINK_BUTTON.format( - rendered['link'], rendered['link_target'], cl.button_class, rendered['text'] + rendered['link'], rendered['link_target'], button_class, rendered['text'] ) except Exception as e: template_code += f'' \ diff --git a/netbox/netbox/choices.py b/netbox/netbox/choices.py index e558463c7..60a1969b1 100644 --- a/netbox/netbox/choices.py +++ b/netbox/netbox/choices.py @@ -84,7 +84,7 @@ class ButtonColorChoices(ChoiceSet): """ Map standard button color choices to Bootstrap 3 button classes """ - DEFAULT = 'outline-secondary' + DEFAULT = 'default' BLUE = 'blue' INDIGO = 'indigo' PURPLE = 'purple'