From 648aabc3104762a9e42e2eff3237d6cc303ecbdf Mon Sep 17 00:00:00 2001 From: FinnStutzenstein Date: Tue, 9 Apr 2019 19:38:01 +0200 Subject: [PATCH] Unset font if the mediafile is deleted --- openslides/mediafiles/views.py | 9 +++++++++ 1 file changed, 9 insertions(+) diff --git a/openslides/mediafiles/views.py b/openslides/mediafiles/views.py index 5684ebb89..f7a88c492 100644 --- a/openslides/mediafiles/views.py +++ b/openslides/mediafiles/views.py @@ -77,12 +77,21 @@ class MediafileViewSet(ModelViewSet): # on server via Django methods (file, open(), save(), ...). mediafile = self.get_object() mediafile.mediafile.storage.delete(mediafile.mediafile.name) + + # check if the file was used as a logo or font for logo in config["logos_available"]: if config[logo]["path"] == mediafile.mediafile.url: config[logo] = { "display_name": config[logo]["display_name"], "path": "", } + for font in config["fonts_available"]: + if config[font]["path"] == mediafile.mediafile.url: + config[font] = { + "display_name": config[font]["display_name"], + "default": config[font]["default"], + "path": "", + } return super().destroy(request, *args, **kwargs)