Skip to content

Commit

Permalink
Fix Edit use case
Browse files Browse the repository at this point in the history
  • Loading branch information
renatoalmeidaoliveira committed Feb 11, 2025
1 parent e15638f commit 734468f
Showing 1 changed file with 8 additions and 2 deletions.
10 changes: 8 additions & 2 deletions netbox/extras/forms/model_forms.py
Original file line number Diff line number Diff line change
Expand Up @@ -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

Expand Down

0 comments on commit 734468f

Please sign in to comment.