You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Using django 1.8.4, I'm getting the following error when trying to serialize a FileField:
<FieldFile: sampleapp/img5_L3sBxJI.png> is not JSON serializable
Traceback:
[...]
File "/home/vagrant/.venvs/infra_env/local/lib/python2.7/site-packages/swampdragon/models.py" in save
self._publish(self.action, self.changed_fields)
File "/home/vagrant/.venvs/infra_env/local/lib/python2.7/site-packages/swampdragon/models.py" in _publish
Using django 1.8.4, I'm getting the following error when trying to serialize a FileField:
<FieldFile: sampleapp/img5_L3sBxJI.png> is not JSON serializable
Traceback:
[...]
File "/home/vagrant/.venvs/infra_env/local/lib/python2.7/site-packages/swampdragon/models.py" in save
Exception Type: TypeError at /admin/mapping/tile/5/
Exception Value: <FieldFile: sampleapp/img5_L3sBxJI.png> is not JSON serializable
The problem seems to be in https://github.com/jonashagstedt/swampdragon/blob/master/swampdragon/serializers/field_serializers.py#L34 we're checking if type of of the 'value' is a FileField, but it's actually a FieldFile as described in the traceback above and explained at https://docs.djangoproject.com/en/1.8/ref/models/fields/#filefield-and-fieldfile.
Hence, I think we should be using FileSerializer in the case where value is a FieldFile as well.
The text was updated successfully, but these errors were encountered: