##// END OF EJS Templates
Allow deleting attachments with their files already deleted
neko259 -
r1879:2272bd98 default
parent child Browse files
Show More
@@ -126,10 +126,16 b' def rebuild_refmap(instance, **kwargs):'
126 def delete_file(instance, **kwargs):
126 def delete_file(instance, **kwargs):
127 if instance.is_internal():
127 if instance.is_internal():
128 file = MEDIA_ROOT + instance.file.name
128 file = MEDIA_ROOT + instance.file.name
129 os.remove(file)
129 try:
130 os.remove(file)
131 except FileNotFoundError:
132 pass
130 if instance.mimetype in FILE_TYPES_IMAGE:
133 if instance.mimetype in FILE_TYPES_IMAGE:
131 for size in THUMB_SIZES:
134 for size in THUMB_SIZES:
132 file_name_parts = instance.file.name.split('.')
135 file_name_parts = instance.file.name.split('.')
133 thumb_file = MEDIA_ROOT + '{}.{}x{}.{}'.format(file_name_parts[0], size[0], size[1], file_name_parts[1])
136 thumb_file = MEDIA_ROOT + '{}.{}x{}.{}'.format(file_name_parts[0], size[0], size[1], file_name_parts[1])
134 os.remove(thumb_file)
137 try:
138 os.remove(thumb_file)
139 except FileNotFoundError:
140 pass
135
141
@@ -18,7 +18,8 b' class TagGalleryView(BaseBoardView, Pagi'
18 page = int(request.GET.get('page', 1))
18 page = int(request.GET.get('page', 1))
19
19
20 params = dict()
20 params = dict()
21 tag = get_object_or_404(Tag, name=tag_name)
21 tag_alias = get_object_or_404(TagAlias, name=tag_name)
22 tag = tag_alias.parent
22 params['tag'] = tag
23 params['tag'] = tag
23 paginator = get_paginator(tag.get_images(), IMAGES_PER_PAGE,
24 paginator = get_paginator(tag.get_images(), IMAGES_PER_PAGE,
24 current_page=page)
25 current_page=page)
General Comments 0
You need to be logged in to leave comments. Login now