# HG changeset patch # User neko259 # Date 2016-05-22 11:20:10 # Node ID 0695b6a948b7bd6425170b9dca5c1c46851465fa # Parent beb328602bc826a895430167e657546646f34102 Fixed post deletion and export to JSON diff --git a/boards/models/post/export.py b/boards/models/post/export.py --- a/boards/models/post/export.py +++ b/boards/models/post/export.py @@ -37,10 +37,10 @@ class JsonExporter(Exporter): 'title': post.title, 'text': post.get_raw_text(), } - if post.images.exists(): + if post.attachments.exists(): post_image = post.get_first_image() - post_json['image'] = post_image.image.url - post_json['image_preview'] = post_image.image.url_200x150 + post_json['image'] = post_image.file.url + post_json['image_preview'] = post_image.get_preview_url() if include_last_update: post_json['bump_time'] = utils.datetime_to_epoch( post.get_thread().bump_time) diff --git a/boards/signals.py b/boards/signals.py --- a/boards/signals.py +++ b/boards/signals.py @@ -69,14 +69,6 @@ def parse_text(instance, **kwargs): @receiver(pre_delete, sender=Post) -def delete_images(instance, **kwargs): - for image in instance.images.all(): - image_refs_count = image.post_images.count() - if image_refs_count == 1: - image.delete() - - -@receiver(pre_delete, sender=Post) def delete_attachments(instance, **kwargs): for attachment in instance.attachments.all(): attachment_refs_count = attachment.attachment_posts.count()