# HG changeset patch # User Pavel Ryapolov # Date 2013-09-18 11:43:40 # Node ID 46eb401a3ec064e6a9d977ccf5688ff4f4536b71 # Parent 8cbfd8023d9d641310273e8d64a222f477c5f98e Updating thread's last edit time when deleting a reply diff --git a/boards/models.py b/boards/models.py --- a/boards/models.py +++ b/boards/models.py @@ -66,6 +66,13 @@ class PostManager(models.Manager): def delete_post(self, post): if post.replies.count() > 0: map(self.delete_post, post.replies.all()) + + # Update thread's last edit time (used as cache key) + thread = post.thread + if thread: + thread.last_edit_time = timezone.now() + thread.save() + post.delete() def delete_posts_by_ip(self, ip):