diff --git a/requirements.txt b/requirements.txt index 946cf442..e116de5f 100644 --- a/requirements.txt +++ b/requirements.txt @@ -28,7 +28,7 @@ raven==5.1.1 bleach==1.4 django-ipware==0.1.0 premailer==2.8.1 -django-transactional-cleanup==0.1.14 +django-transactional-cleanup==0.1.15 lxml==3.4.1 git+https://github.com/Xof/django-pglocks.git@dbb8d7375066859f897604132bd437832d2014ea pyjwkest==1.0.3 diff --git a/taiga/projects/attachments/__init__.py b/taiga/projects/attachments/__init__.py index e69de29b..fcc59d48 100644 --- a/taiga/projects/attachments/__init__.py +++ b/taiga/projects/attachments/__init__.py @@ -0,0 +1,17 @@ +# Copyright (C) 2014 Andrey Antukh +# Copyright (C) 2014 Jesús Espino +# Copyright (C) 2014 David Barragán +# This program is free software: you can redistribute it and/or modify +# it under the terms of the GNU Affero General Public License as +# published by the Free Software Foundation, either version 3 of the +# License, or (at your option) any later version. +# +# This program is distributed in the hope that it will be useful, +# but WITHOUT ANY WARRANTY; without even the implied warranty of +# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +# GNU Affero General Public License for more details. +# +# You should have received a copy of the GNU Affero General Public License +# along with this program. If not, see . + +default_app_config = "taiga.projects.attachments.apps.AttachmentsAppConfig" diff --git a/taiga/projects/attachments/apps.py b/taiga/projects/attachments/apps.py new file mode 100644 index 00000000..a4497463 --- /dev/null +++ b/taiga/projects/attachments/apps.py @@ -0,0 +1,38 @@ +# Copyright (C) 2014 Andrey Antukh +# Copyright (C) 2014 Jesús Espino +# Copyright (C) 2014 David Barragán +# This program is free software: you can redistribute it and/or modify +# it under the terms of the GNU Affero General Public License as +# published by the Free Software Foundation, either version 3 of the +# License, or (at your option) any later version. +# +# This program is distributed in the hope that it will be useful, +# but WITHOUT ANY WARRANTY; without even the implied warranty of +# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +# GNU Affero General Public License for more details. +# +# You should have received a copy of the GNU Affero General Public License +# along with this program. If not, see . + +from easy_thumbnails.files import get_thumbnailer + +from django.apps import AppConfig +from django.apps import apps +from django_transactional_cleanup.signals import cleanup_post_delete + + +def thumbnail_delete(**kwargs): + thumbnailer = get_thumbnailer(kwargs["file"]) + thumbnailer.delete_thumbnails() + + +def connect_attachment_signals(): + cleanup_post_delete.connect(thumbnail_delete) + + +class AttachmentsAppConfig(AppConfig): + name = "taiga.projects.attachments" + verbose_name = "Attachments" + + def ready(self): + connect_attachment_signals()