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
When deleting a media file that is in use, a network error is displayed
Steps to Reproduce
Go to 'Media Library'
Try to delete a media file that is being used as the organisation icon
See error
Expected Behavior
I think we could display a more understandable (user-friendly) message.
Like: "This media file can't be deleted because it is in use"
Actual Behavior
The following error is displayed:
A network error has occurred. Please try again later.
Additional Information
Traceback
Dec 06 11:32:21 ERROR django.request - 500 Internal Server Error: /ajax/media/file/delete/
Traceback (most recent call last):
File "/home/tory/Integreat/integreat-cms/.venv/lib/python3.9/site-packages/django/core/handlers/exception.py", line 47, in inner
response = get_response(request)
File "/home/tory/Integreat/integreat-cms/.venv/lib/python3.9/site-packages/django/core/handlers/base.py", line 181, in _get_response
response = wrapped_callback(request, *callback_args, **callback_kwargs)
File "/home/tory/Integreat/integreat-cms/.venv/lib/python3.9/site-packages/django/views/decorators/http.py", line 40, in inner
return func(request, *args, **kwargs)
File "/home/tory/Integreat/integreat-cms/.venv/lib/python3.9/site-packages/django/contrib/auth/decorators.py", line 21, in _wrapped_view
return view_func(request, *args, **kwargs)
File "/home/tory/Integreat/integreat-cms/integreat_cms/api/decorators.py", line 115, in wrap
return function(request, *args, **kwargs)
File "/home/tory/Integreat/integreat-cms/integreat_cms/cms/views/media/media_actions.py", line 361, in delete_file_ajax
media_file.delete()
File "/home/tory/Integreat/integreat-cms/.venv/lib/python3.9/site-packages/django/db/models/base.py", line 966, in delete
collector.collect([self], keep_parents=keep_parents)
File "/home/tory/Integreat/integreat-cms/.venv/lib/python3.9/site-packages/django/db/models/deletion.py", line 302, in collect
raise ProtectedError(
django.db.models.deletion.ProtectedError: ("Cannot delete some instances of model 'MediaFile' because they are referenced through protected foreign keys: 'Organization.icon'.", {<Organization (id: 1, slug: test-organization, region: augsburg)>})
The text was updated successfully, but these errors were encountered:
If so, what do we do with organisations, where the logo is mandatory, and the deleted file was used as a logo?
That's why we want to prevent media files from being deleted when they are used. But I agree with you that just showing an error is not user friendly 😅
Or maybe we should disable the "delete" button in this case, and show a tooltip message?
I think disabling is the best. The reason can be explained like for archiving a mirrored page:
Describe the Bug
When deleting a media file that is in use, a network error is displayed
Steps to Reproduce
Expected Behavior
I think we could display a more understandable (user-friendly) message.
Like: "This media file can't be deleted because it is in use"
Actual Behavior
The following error is displayed:
A network error has occurred. Please try again later.
Additional Information
Traceback
The text was updated successfully, but these errors were encountered: