##// END OF EJS Templates
Implemented bumplimit.
neko259 -
r38:3006249c default
parent child Browse files
Show More
@@ -38,9 +38,7 b' class PostManager(models.Manager):'
38 38 post.tags.add(tag)
39 39
40 40 if parent_id != NO_PARENT:
41 parent = self.get(id=parent_id)
42 parent.last_edit_time=timezone.now()
43 parent.save()
41 self._bump_thread(parent_id)
44 42 else:
45 43 self._delete_old_threads()
46 44
@@ -104,6 +102,14 b' class PostManager(models.Manager):'
104 102 for thread in old_threads:
105 103 self.delete_post(thread)
106 104
105 def _bump_thread(self, thread_id):
106 thread = self.get(id=thread_id)
107
108 replies_count = len(self.get_thread(thread_id))
109 if replies_count <= settings.MAX_POSTS_PER_THREAD:
110 thread.last_edit_time = timezone.now()
111 thread.save()
112
107 113
108 114 class TagManager(models.Manager):
109 115 def get_not_empty_tags(self):
@@ -167,8 +167,8 b' LOGGING = {'
167 167 }
168 168
169 169 # Custom imageboard settings
170 MAX_POSTS_PER_THREAD = 100
171 MAX_THREAD_COUNT = 20
170 MAX_POSTS_PER_THREAD = 500 # Thread bumplimit
171 MAX_THREAD_COUNT = 20 # Old threads will be deleted to preserve this count
172 172 SITE_NAME = 'Neboard'
173 173
174 174 THEMES = [
@@ -46,7 +46,7 b''
46 46
47 47 <form enctype="multipart/form-data" method="post">{% csrf_token %}
48 48 <div class="post-form-w">
49 <div class="form-title">{% trans "Create new thread" %}</div>
49 <div class="form-title">{% trans "Reply to thread" %}</div>
50 50 <div class="post-form">
51 51 <div class="form-row">
52 52 <div class="form-label">{% trans 'Title' %}</div>
@@ -71,4 +71,4 b''
71 71 </div>
72 72 </form>
73 73
74 {% endblock %} No newline at end of file
74 {% endblock %}
General Comments 0
You need to be logged in to leave comments. Login now