##// END OF EJS Templates
Added index on post.opening. Use it when getting OP of a thread
neko259 -
r1381:197e4fa8 default
parent child Browse files
Show More
@@ -0,0 +1,19 b''
1 # -*- coding: utf-8 -*-
2 from __future__ import unicode_literals
3
4 from django.db import migrations, models
5
6
7 class Migration(migrations.Migration):
8
9 dependencies = [
10 ('boards', '0034_auto_20151014_2253'),
11 ]
12
13 operations = [
14 migrations.AlterField(
15 model_name='post',
16 name='opening',
17 field=models.BooleanField(db_index=True),
18 ),
19 ]
@@ -98,7 +98,7 b' class Post(models.Model, Viewable):'
98 uid = models.TextField(db_index=True)
98 uid = models.TextField(db_index=True)
99
99
100 tripcode = models.CharField(max_length=50, blank=True, default='')
100 tripcode = models.CharField(max_length=50, blank=True, default='')
101 opening = models.BooleanField()
101 opening = models.BooleanField(db_index=True)
102 hidden = models.BooleanField(default=False)
102 hidden = models.BooleanField(default=False)
103
103
104 def __str__(self):
104 def __str__(self):
@@ -194,7 +194,7 b' class Thread(models.Model):'
194 Gets the first post of the thread
194 Gets the first post of the thread
195 """
195 """
196
196
197 query = self.get_replies().order_by('pub_time')
197 query = self.get_replies().filter(opening=True)
198 if only_id:
198 if only_id:
199 query = query.only('id')
199 query = query.only('id')
200 opening_post = query.first()
200 opening_post = query.first()
@@ -109,7 +109,7 b' TEMPLATE_CONTEXT_PROCESSORS = ('
109 'boards.context_processors.user_and_ui_processor',
109 'boards.context_processors.user_and_ui_processor',
110 )
110 )
111
111
112 MIDDLEWARE_CLASSES = (
112 MIDDLEWARE_CLASSES = [
113 'django.middleware.http.ConditionalGetMiddleware',
113 'django.middleware.http.ConditionalGetMiddleware',
114 'django.contrib.sessions.middleware.SessionMiddleware',
114 'django.contrib.sessions.middleware.SessionMiddleware',
115 'django.middleware.locale.LocaleMiddleware',
115 'django.middleware.locale.LocaleMiddleware',
@@ -118,7 +118,7 b' MIDDLEWARE_CLASSES = ('
118 'django.contrib.messages.middleware.MessageMiddleware',
118 'django.contrib.messages.middleware.MessageMiddleware',
119 'boards.middlewares.BanMiddleware',
119 'boards.middlewares.BanMiddleware',
120 'boards.middlewares.TimezoneMiddleware',
120 'boards.middlewares.TimezoneMiddleware',
121 )
121 ]
122
122
123 ROOT_URLCONF = 'neboard.urls'
123 ROOT_URLCONF = 'neboard.urls'
124
124
@@ -208,6 +208,8 b' IMAGE_VIEWERS = ['
208 ('popup', 'Popup'),
208 ('popup', 'Popup'),
209 ]
209 ]
210
210
211 ALLOWED_HOSTS = ['*']
212
211 POSTING_DELAY = 20 # seconds
213 POSTING_DELAY = 20 # seconds
212
214
213 # Websocket settins
215 # Websocket settins
@@ -219,21 +221,20 b" CENTRIFUGE_PROJECT_ID = '<project id her"
219 CENTRIFUGE_PROJECT_SECRET = '<project secret here>'
221 CENTRIFUGE_PROJECT_SECRET = '<project secret here>'
220 CENTRIFUGE_TIMEOUT = 5
222 CENTRIFUGE_TIMEOUT = 5
221
223
222 # Debug mode middlewares
224 # Debug middlewares
223 if DEBUG:
225 MIDDLEWARE_CLASSES += [
224 MIDDLEWARE_CLASSES += (
226 'debug_toolbar.middleware.DebugToolbarMiddleware',
225 'debug_toolbar.middleware.DebugToolbarMiddleware',
227 ]
226 )
227
228
228 def custom_show_toolbar(request):
229 def custom_show_toolbar(request):
229 return True
230 return request.user.has_perm('admin.debug')
230
231
231 DEBUG_TOOLBAR_CONFIG = {
232 DEBUG_TOOLBAR_CONFIG = {
232 'ENABLE_STACKTRACES': True,
233 'ENABLE_STACKTRACES': True,
233 'SHOW_TOOLBAR_CALLBACK': 'neboard.settings.custom_show_toolbar',
234 'SHOW_TOOLBAR_CALLBACK': 'neboard.settings.custom_show_toolbar',
234 }
235 }
235
236
236 # FIXME Uncommenting this fails somehow. Need to investigate this
237 # FIXME Uncommenting this fails somehow. Need to investigate this
237 #DEBUG_TOOLBAR_PANELS += (
238 #DEBUG_TOOLBAR_PANELS += (
238 # 'debug_toolbar.panels.profiling.ProfilingDebugPanel',
239 # 'debug_toolbar.panels.profiling.ProfilingDebugPanel',
239 #)
240 #)
General Comments 0
You need to be logged in to leave comments. Login now