Closed sevdog closed 1 month ago
The storage exists on the FileField, the error you are seeing is on the FieldFile. Something doesn't add up, one shouldn't affect the other.
Was unable to reproduce, let me know if this is still an issue.
This issue has been automatically locked since there has not been any recent activity after it was closed. Please open a new issue for related bugs.
The currently implementation of
fields_for_model_instance
method performs a "safe" get-attribut but it is not currently handling the possibility that the field is not returned:https://github.com/un1t/django-cleanup/blob/eee7785bd219c4bb8a79e88648e8843bd215be4d/src/django_cleanup/cache.py#L84-L86
If by any means the field is not found on the model instance the code tries to read attributes from a
None
, thus resulting in anAttributeError
.When using in conjunction with the
InMemoryStorage
with a configuration like the following an error is raised when a file is copied between two modelsWhich causes the following error:
We got into this issue while moving tests from
FileSystemStorage
/under which the code above works) toInMemoryStorage
(under which it does not).PS: there is also a problem with the file because it does not define a
name
property and that was reported to django in https://code.djangoproject.com/ticket/35658