diff --git a/boards/models/post/__init__.py b/boards/models/post/__init__.py --- a/boards/models/post/__init__.py +++ b/boards/models/post/__init__.py @@ -83,15 +83,13 @@ class PostManager(models.Manager): opening_posts = [] posting_time = timezone.now() + new_thread = False if not thread: thread = boards.models.thread.Thread.objects.create( bump_time=posting_time, last_edit_time=posting_time) list(map(thread.tags.add, tags)) boards.models.thread.Thread.objects.process_oldest_threads() - else: - thread.last_edit_time = posting_time - thread.bump() - thread.save() + new_thread = True pre_text = Parser().preparse(text) @@ -115,6 +113,12 @@ class PostManager(models.Manager): post.connect_threads(opening_posts) post.connect_notifications() + # Thread needs to be bumped only when the post is already created + if not new_thread: + thread.last_edit_time = posting_time + thread.bump() + thread.save() + return post def delete_posts_by_ip(self, ip): diff --git a/boards/utils.py b/boards/utils.py --- a/boards/utils.py +++ b/boards/utils.py @@ -3,7 +3,6 @@ This module contains helper functions an """ import time import hmac -import functools from django.core.cache import cache from django.db.models import Model