Skip to content

Commit

Permalink
Merge pull request #14 from crodriguezgarci/hotfix/fix_value_error_on…
Browse files Browse the repository at this point in the history
…_filefield

Fix ValueError on FileFields on get form data
  • Loading branch information
crodriguezgarci authored Nov 4, 2021
2 parents 300bc1d + c045d60 commit d5875ff
Showing 1 changed file with 6 additions and 3 deletions.
9 changes: 6 additions & 3 deletions django_remote_forms/forms.py
Original file line number Diff line number Diff line change
Expand Up @@ -196,9 +196,12 @@ def as_dict(self, validated=True):

for field_name in file_fields:
obj = form_dict['data'].get(field_name, None)
if getattr(obj, 'url', None):
form_dict['data'][field_name] = obj.url
else:
try:
if getattr(obj, 'url', None):
form_dict['data'][field_name] = obj.url
else:
form_dict['data'][field_name] = None
except ValueError:
form_dict['data'][field_name] = None

return resolve_promise(form_dict)

0 comments on commit d5875ff

Please sign in to comment.