##// END OF EJS Templates
Fixed post deletion and export to JSON
neko259 -
r1603:0695b6a9 default
parent child Browse files
Show More
@@ -37,10 +37,10 b' class JsonExporter(Exporter):'
37 37 'title': post.title,
38 38 'text': post.get_raw_text(),
39 39 }
40 if post.images.exists():
40 if post.attachments.exists():
41 41 post_image = post.get_first_image()
42 post_json['image'] = post_image.image.url
43 post_json['image_preview'] = post_image.image.url_200x150
42 post_json['image'] = post_image.file.url
43 post_json['image_preview'] = post_image.get_preview_url()
44 44 if include_last_update:
45 45 post_json['bump_time'] = utils.datetime_to_epoch(
46 46 post.get_thread().bump_time)
@@ -69,14 +69,6 b' def parse_text(instance, **kwargs):'
69 69
70 70
71 71 @receiver(pre_delete, sender=Post)
72 def delete_images(instance, **kwargs):
73 for image in instance.images.all():
74 image_refs_count = image.post_images.count()
75 if image_refs_count == 1:
76 image.delete()
77
78
79 @receiver(pre_delete, sender=Post)
80 72 def delete_attachments(instance, **kwargs):
81 73 for attachment in instance.attachments.all():
82 74 attachment_refs_count = attachment.attachment_posts.count()
General Comments 0
You need to be logged in to leave comments. Login now