From 734468fb996cc4b47e37ecf0e01282ea3b74bc0d Mon Sep 17 00:00:00 2001 From: Renato Almeida de Oliveira Zaroubin Date: Tue, 11 Feb 2025 23:54:49 +0000 Subject: [PATCH] Fix Edit use case --- netbox/extras/forms/model_forms.py | 10 ++++++++-- 1 file changed, 8 insertions(+), 2 deletions(-) diff --git a/netbox/extras/forms/model_forms.py b/netbox/extras/forms/model_forms.py index d1255cd322..50ca6329cf 100644 --- a/netbox/extras/forms/model_forms.py +++ b/netbox/extras/forms/model_forms.py @@ -185,8 +185,14 @@ def __init__(self, *args, initial=None, **kwargs): extra_choices = [extra_choices] choices = "" for choice in extra_choices: - choice_str = ":".join(choice.replace("'", "").replace(" ", "")[1:-1].split(",")) - choices += choice_str + "\n" + # Setup choices in Add Another use case + if isinstance(choice, str): + choice_str = ":".join(choice.replace("'", "").replace(" ", "")[1:-1].split(",")) + choices += choice_str + "\n" + # Setup choices in Edit use case + elif isinstance(choice, list): + choice_str = ":".join(choice) + choices += choice_str + "\n" self.initial['extra_choices'] = choices