Skip to content

Commit

Permalink
Merge pull request #68 from Yupeek/develop
Browse files Browse the repository at this point in the history
release 1.8.7
  • Loading branch information
Quayle57 authored Sep 9, 2020
2 parents 2423bd5 + ad4882a commit 3750a4b
Showing 1 changed file with 4 additions and 4 deletions.
8 changes: 4 additions & 4 deletions rest_models/backend/compiler.py
Original file line number Diff line number Diff line change
Expand Up @@ -1058,7 +1058,7 @@ def resolve_data_n_files(self, obj):
file = fieldfile.name

if file is not None: # field value can be None....
files[field.column] = (file.name, file, file.content_type)
files[field.column] = (file.name, file, getattr(file, 'content_type', None))
else:
data[field.column] = None
else:
Expand Down Expand Up @@ -1213,6 +1213,7 @@ class FakeCursor(object):
"""
a fake cursor with rowcount
"""

def __init__(self, rowcount):
self.rowcount = rowcount

Expand Down Expand Up @@ -1307,8 +1308,7 @@ def resolve_data_n_files(self):
# str => we don't change it since it's not comming from our custom storage
pass
else:
files[field.column] = (file.name, file, file.content_type)

files[field.column] = (file.name, file, getattr(file, 'content_type', None))
else:
fieldname = field.concrete and field.db_column or field.name
data[fieldname] = field.get_db_prep_save(val, connection=self.connection)
Expand Down Expand Up @@ -1336,7 +1336,7 @@ def execute_sql(self, result_type=MULTI, chunk_size=None):
if result.status_code not in (200, 202, 204):
raise FakeDatabaseDbAPI2.ProgrammingError(
"error while updating %s.pk=%s with data=%s,files=%s.\n%s" % (
query.model.__name__, id_, data, files, message_from_response(result))
query.model.__name__, id_, data, files, message_from_response(result))
)

# update object instance using result data if possible
Expand Down

0 comments on commit 3750a4b

Please sign in to comment.