##// 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 post.tags.add(tag)
38 post.tags.add(tag)
39
39
40 if parent_id != NO_PARENT:
40 if parent_id != NO_PARENT:
41 parent = self.get(id=parent_id)
41 self._bump_thread(parent_id)
42 parent.last_edit_time=timezone.now()
43 parent.save()
44 else:
42 else:
45 self._delete_old_threads()
43 self._delete_old_threads()
46
44
@@ -104,6 +102,14 b' class PostManager(models.Manager):'
104 for thread in old_threads:
102 for thread in old_threads:
105 self.delete_post(thread)
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 class TagManager(models.Manager):
114 class TagManager(models.Manager):
109 def get_not_empty_tags(self):
115 def get_not_empty_tags(self):
@@ -167,8 +167,8 b' LOGGING = {'
167 }
167 }
168
168
169 # Custom imageboard settings
169 # Custom imageboard settings
170 MAX_POSTS_PER_THREAD = 100
170 MAX_POSTS_PER_THREAD = 500 # Thread bumplimit
171 MAX_THREAD_COUNT = 20
171 MAX_THREAD_COUNT = 20 # Old threads will be deleted to preserve this count
172 SITE_NAME = 'Neboard'
172 SITE_NAME = 'Neboard'
173
173
174 THEMES = [
174 THEMES = [
@@ -46,7 +46,7 b''
46
46
47 <form enctype="multipart/form-data" method="post">{% csrf_token %}
47 <form enctype="multipart/form-data" method="post">{% csrf_token %}
48 <div class="post-form-w">
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 <div class="post-form">
50 <div class="post-form">
51 <div class="form-row">
51 <div class="form-row">
52 <div class="form-label">{% trans 'Title' %}</div>
52 <div class="form-label">{% trans 'Title' %}</div>
@@ -71,4 +71,4 b''
71 </div>
71 </div>
72 </form>
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