Removing thumbnails on attachment deletion
parent
ca6239eda2
commit
7d9f3914c0
|
@ -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
|
||||
|
|
|
@ -0,0 +1,17 @@
|
|||
# Copyright (C) 2014 Andrey Antukh <niwi@niwi.be>
|
||||
# Copyright (C) 2014 Jesús Espino <jespinog@gmail.com>
|
||||
# Copyright (C) 2014 David Barragán <bameda@dbarragan.com>
|
||||
# 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 <http://www.gnu.org/licenses/>.
|
||||
|
||||
default_app_config = "taiga.projects.attachments.apps.AttachmentsAppConfig"
|
|
@ -0,0 +1,38 @@
|
|||
# Copyright (C) 2014 Andrey Antukh <niwi@niwi.be>
|
||||
# Copyright (C) 2014 Jesús Espino <jespinog@gmail.com>
|
||||
# Copyright (C) 2014 David Barragán <bameda@dbarragan.com>
|
||||
# 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 <http://www.gnu.org/licenses/>.
|
||||
|
||||
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()
|
Loading…
Reference in New Issue