# HG changeset patch # User neko259 # Date 2013-04-15 17:30:57 # Node ID 3006249c01a6100ac8fd72a776d1848cd9e71648 # Parent 09d0dd15400c7c1f74fcdecf190c5568946cbec7 Implemented bumplimit. diff --git a/boards/models.py b/boards/models.py --- a/boards/models.py +++ b/boards/models.py @@ -38,9 +38,7 @@ class PostManager(models.Manager): post.tags.add(tag) if parent_id != NO_PARENT: - parent = self.get(id=parent_id) - parent.last_edit_time=timezone.now() - parent.save() + self._bump_thread(parent_id) else: self._delete_old_threads() @@ -104,6 +102,14 @@ class PostManager(models.Manager): for thread in old_threads: self.delete_post(thread) + def _bump_thread(self, thread_id): + thread = self.get(id=thread_id) + + replies_count = len(self.get_thread(thread_id)) + if replies_count <= settings.MAX_POSTS_PER_THREAD: + thread.last_edit_time = timezone.now() + thread.save() + class TagManager(models.Manager): def get_not_empty_tags(self): diff --git a/neboard/settings.py b/neboard/settings.py --- a/neboard/settings.py +++ b/neboard/settings.py @@ -167,8 +167,8 @@ LOGGING = { } # Custom imageboard settings -MAX_POSTS_PER_THREAD = 100 -MAX_THREAD_COUNT = 20 +MAX_POSTS_PER_THREAD = 500 # Thread bumplimit +MAX_THREAD_COUNT = 20 # Old threads will be deleted to preserve this count SITE_NAME = 'Neboard' THEMES = [ diff --git a/templates/thread.html b/templates/thread.html --- a/templates/thread.html +++ b/templates/thread.html @@ -46,7 +46,7 @@
{% csrf_token %}
-
{% trans "Create new thread" %}
+
{% trans "Reply to thread" %}
{% trans 'Title' %}
@@ -71,4 +71,4 @@
-{% endblock %} \ No newline at end of file +{% endblock %}