Reset logo configs if logo is deleted.
This commit is contained in:
parent
c1a818a368
commit
4b6ce77d36
@ -23,6 +23,7 @@ Core:
|
|||||||
- Added password reset link (password reset via email) [#3914, #4199].
|
- Added password reset link (password reset via email) [#3914, #4199].
|
||||||
- Added global history mode [#3977, #4141].
|
- Added global history mode [#3977, #4141].
|
||||||
- Projector refactoring [4119, #4130].
|
- Projector refactoring [4119, #4130].
|
||||||
|
- Fixed logo configuration if logo file is deleted [#4374].
|
||||||
|
|
||||||
Agenda:
|
Agenda:
|
||||||
- Added viewpoint to assign multiple items to a new parent item [#4037].
|
- Added viewpoint to assign multiple items to a new parent item [#4037].
|
||||||
|
@ -1,6 +1,7 @@
|
|||||||
from django.http import HttpResponseForbidden, HttpResponseNotFound
|
from django.http import HttpResponseForbidden, HttpResponseNotFound
|
||||||
from django.views.static import serve
|
from django.views.static import serve
|
||||||
|
|
||||||
|
from ..core.config import config
|
||||||
from ..utils.auth import has_perm
|
from ..utils.auth import has_perm
|
||||||
from ..utils.rest_api import ModelViewSet, ValidationError
|
from ..utils.rest_api import ModelViewSet, ValidationError
|
||||||
from .access_permissions import MediafileAccessPermissions
|
from .access_permissions import MediafileAccessPermissions
|
||||||
@ -76,6 +77,12 @@ class MediafileViewSet(ModelViewSet):
|
|||||||
# on server via Django methods (file, open(), save(), ...).
|
# on server via Django methods (file, open(), save(), ...).
|
||||||
mediafile = self.get_object()
|
mediafile = self.get_object()
|
||||||
mediafile.mediafile.storage.delete(mediafile.mediafile.name)
|
mediafile.mediafile.storage.delete(mediafile.mediafile.name)
|
||||||
|
for logo in config["logos_available"]:
|
||||||
|
if config[logo]["path"] == mediafile.mediafile.url:
|
||||||
|
config[logo] = {
|
||||||
|
"display_name": config[logo]["display_name"],
|
||||||
|
"path": "",
|
||||||
|
}
|
||||||
return super().destroy(request, *args, **kwargs)
|
return super().destroy(request, *args, **kwargs)
|
||||||
|
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user