Skip to content

Commit

Permalink
Fixed Strategy instance processing 🤡
Browse files Browse the repository at this point in the history
  • Loading branch information
Sibyx committed Aug 16, 2024
1 parent 2a89172 commit feb39ed
Showing 1 changed file with 6 additions and 3 deletions.
9 changes: 6 additions & 3 deletions django_api_forms/forms.py
Original file line number Diff line number Diff line change
Expand Up @@ -191,9 +191,12 @@ def populate(self, obj, exclude: List[str] = None):
if isinstance(self.Meta, type):
if hasattr(self.Meta, 'field_strategy'):
if key in self.Meta.field_strategy.keys():
strategy = resolve_from_path(
self.Meta.field_strategy[key]
)
if isinstance(self.Meta.field_strategy[key], str):
strategy = resolve_from_path(
self.Meta.field_strategy[key]
)
else:
strategy = self.Meta.field_strategy[key]

if hasattr(self, f'populate_{key}'):
self.cleaned_data[key] = getattr(self, f'populate_{key}')(obj, self.cleaned_data[key])
Expand Down

0 comments on commit feb39ed

Please sign in to comment.