Skip to content

Commit

Permalink
implement choice feedback
Browse files Browse the repository at this point in the history
  • Loading branch information
noLeonardo authored Dec 17, 2024
1 parent 4a8c210 commit 6b4b2f2
Showing 1 changed file with 4 additions and 4 deletions.
8 changes: 4 additions & 4 deletions ui/runs/forms/custom_fields.py
Original file line number Diff line number Diff line change
Expand Up @@ -49,7 +49,7 @@ def __init__(self, choices: Enum | list, initial=None, *args, **kwargs):
super().__init__(choices=choices, initial=initial, *args, **kwargs)
else:
super().__init__(
choices=[(el.value, el.value) for el in choices],
choices=[(choice.value, choice.value) for choice in choices],
initial=initial,
*args,
**kwargs,
Expand Down Expand Up @@ -77,7 +77,7 @@ def __init__(self, choices: Enum | list, initial=None, *args, **kwargs):
super().__init__(choices=choices, initial=initial, *args, **kwargs)
else:
super().__init__(
choices=[(el.value, el.value) for el in choices],
choices=[(choice.value, choice.value) for choice in choices],
initial=initial,
*args,
**kwargs,
Expand All @@ -86,15 +86,15 @@ def __init__(self, choices: Enum | list, initial=None, *args, **kwargs):
self.widget.attrs.update({"class": "form-select mb-2"})

def clean(self, value: list[str] | None):
return [el for el in value if el != "hidden"] if value else None
return [element for element in value if element != "hidden"] if value else None

class CustomCheckboxMultipleChoiceField(MultipleChoiceField):
def __init__(self, choices: Enum | list, colors: Enum | list, initial=None, *args, **kwargs):
if isinstance(choices, list):
super().__init__(choices=choices, initial=initial, *args, **kwargs)
else:
super().__init__(
choices=[(el.value, el.value) for el in choices],
choices=[(choice.value, choice.value) for choice in choices],
initial=initial,
*args,
**kwargs,
Expand Down

0 comments on commit 6b4b2f2

Please sign in to comment.