Skip to content

Commit

Permalink
Fixed lambda assign issue
Browse files Browse the repository at this point in the history
  • Loading branch information
mtyton committed Oct 18, 2023
1 parent d655541 commit a8745ad
Showing 1 changed file with 8 additions and 2 deletions.
10 changes: 8 additions & 2 deletions audoma/drf/filters.py
Original file line number Diff line number Diff line change
Expand Up @@ -21,9 +21,15 @@ def __init__(
else full_choices
)
if hasattr(full_choices, "get_value_by_name"):
coerce = lambda value: full_choices.get_value_by_name(value)

def coerce(value):
return full_choices.get_value_by_name(value)

else:
coerce = lambda value: dict(full_choices).get(value)

def coerce(value):
return dict(full_choices).get(value)

super().__init__(
coerce=coerce,
choices=self.parsed_choices,
Expand Down

0 comments on commit a8745ad

Please sign in to comment.