##// END OF EJS Templates
Added debug suffix to the site name when DEBUG is set to true. Optimized post...
neko259 -
r583:cf14ad32 default
parent child Browse files
Show More
@@ -1,103 +1,97 b''
1 1 {% load i18n %}
2 2 {% load board %}
3 3 {% load cache %}
4 4
5 5 {% get_current_language as LANGUAGE_CODE %}
6 6
7 {% with thread=post.thread_new %}
8 {% with bumpable=thread.can_bump %}
9 7 {% cache 600 post post.id post.last_edit_time thread.archived bumpable truncated moderator LANGUAGE_CODE need_open_link %}
10 8
11 {% with is_opening=post.is_opening %}
12 9 {% spaceless %}
13 10 {% if thread.archived %}
14 11 <div class="post archive_post" id="{{ post.id }}">
15 12 {% elif bumpable %}
16 13 <div class="post" id="{{ post.id }}">
17 14 {% else %}
18 15 <div class="post dead_post" id="{{ post.id }}">
19 16 {% endif %}
20 17
21 18 {% if post.image %}
22 19 <div class="image">
23 20 <a
24 21 class="thumb"
25 22 href="{{ post.image.url }}"><img
26 23 src="{{ post.image.url_200x150 }}"
27 24 alt="{{ post.id }}"
28 25 width="{{ post.image_pre_width }}"
29 26 height="{{ post.image_pre_height }}"
30 27 data-width="{{ post.image_width }}"
31 28 data-height="{{ post.image_height }}"/>
32 29 </a>
33 30 </div>
34 31 {% endif %}
35 32 <div class="message">
36 33 <div class="post-info">
37 34 <span class="title">{{ post.title }}</span>
38 35 <a class="post_id" href="{% post_url post.id %}">
39 36 ({{ post.id }}) </a>
40 37 [<span class="pub_time">{{ post.pub_time }}</span>]
41 38 {% if thread.archived %}
42 39 β€” [{{ thread.bump_time }}]
43 40 {% endif %}
44 41 {% if not truncated and not thread.archived %}
45 42 [<a href="#" onclick="javascript:addQuickReply('{{ post.id }}')
46 43 ; return false;">&gt;&gt;</a>]
47 44 {% endif %}
48 45 {% if is_opening and need_open_link %}
49 46 {% if post.thread_new.archived %}
50 47 [<a class="link" href="{% url 'thread' post.id %}">{% trans "Open" %}</a>]
51 48 {% else %}
52 49 [<a class="link" href="{% url 'thread' post.id %}#form">{% trans "Reply" %}</a>]
53 50 {% endif %}
54 51 {% endif %}
55 52
56 53 {% if moderator %}
57 54 <span class="moderator_info">
58 55 [<a href="{% url 'post_admin' post_id=post.id %}"
59 56 >{% trans 'Edit' %}</a>]
60 57 [<a href="{% url 'delete' post_id=post.id %}"
61 58 >{% trans 'Delete' %}</a>]
62 59 ({{ post.poster_ip }})
63 60 [<a href="{% url 'ban' post_id=post.id %}?next={{ request.path }}"
64 61 >{% trans 'Ban IP' %}</a>]
65 62 </span>
66 63 {% endif %}
67 64 </div>
68 65 {% autoescape off %}
69 66 {% if truncated %}
70 67 {{ post.text.rendered|truncatewords_html:50 }}
71 68 {% else %}
72 69 {{ post.text.rendered }}
73 70 {% endif %}
74 71 {% endautoescape %}
75 72 {% if post.is_referenced %}
76 73 <div class="refmap">
77 74 {% trans "Replies" %}:
78 75 {% for ref_post in post.get_sorted_referenced_posts %}
79 76 <a href="{% post_url ref_post.id %}">&gt;&gt;{{ ref_post.id }}</a
80 77 >{% if not forloop.last %},{% endif %}
81 78 {% endfor %}
82 79 </div>
83 80 {% endif %}
84 81 </div>
85 82 {% if is_opening and thread.tags.exists %}
86 83 <div class="metadata">
87 84 {% if is_opening and need_open_link %}
88 85 {{ thread.get_images_count }} {% trans 'images' %}.
89 86 {% endif %}
90 87 <span class="tags">
91 88 {% for tag in thread.get_tags %}
92 89 <a class="tag" href="{% url 'tag' tag.name %}">
93 90 #{{ tag.name }}</a>{% if not forloop.last %},{% endif %}
94 91 {% endfor %}
95 92 </span>
96 93 </div>
97 94 {% endif %}
98 95 </div>
99 96 {% endspaceless %}
100 {% endwith %}
101 97 {% endcache %}
102 {% endwith %}
103 {% endwith %}
@@ -1,161 +1,163 b''
1 1 {% extends "boards/base.html" %}
2 2
3 3 {% load i18n %}
4 4 {% load cache %}
5 5 {% load board %}
6 6 {% load static %}
7 7
8 8 {% block head %}
9 9 {% if tag %}
10 10 <title>{{ tag.name }} - {{ site_name }}</title>
11 11 {% else %}
12 12 <title>{{ site_name }}</title>
13 13 {% endif %}
14 14
15 15 {% if current_page.has_previous %}
16 16 <link rel="prev" href="
17 17 {% if tag %}
18 18 {% url "tag" tag_name=tag page=current_page.previous_page_number %}
19 19 {% elif archived %}
20 20 {% url "archive" page=current_page.previous_page_number %}
21 21 {% else %}
22 22 {% url "index" page=current_page.previous_page_number %}
23 23 {% endif %}
24 24 " />
25 25 {% endif %}
26 26 {% if current_page.has_next %}
27 27 <link rel="next" href="
28 28 {% if tag %}
29 29 {% url "tag" tag_name=tag page=current_page.next_page_number %}
30 30 {% elif archived %}
31 31 {% url "archive" page=current_page.next_page_number %}
32 32 {% else %}
33 33 {% url "index" page=current_page.next_page_number %}
34 34 {% endif %}
35 35 " />
36 36 {% endif %}
37 37
38 38 {% endblock %}
39 39
40 40 {% block content %}
41 41
42 42 {% get_current_language as LANGUAGE_CODE %}
43 43
44 44 {% if tag %}
45 45 <div class="tag_info">
46 46 <h2>
47 47 {% if tag in user.fav_tags.all %}
48 48 <a href="{% url 'tag' tag.name %}?method=unsubscribe&next={{ request.path }}"
49 49 class="fav">β˜…</a>
50 50 {% else %}
51 51 <a href="{% url 'tag' tag.name %}?method=subscribe&next={{ request.path }}"
52 52 class="not_fav">β˜…</a>
53 53 {% endif %}
54 54 #{{ tag.name }}
55 55 </h2>
56 56 </div>
57 57 {% endif %}
58 58
59 59 {% if threads %}
60 60 {% if current_page.has_previous %}
61 61 <div class="page_link">
62 62 <a href="
63 63 {% if tag %}
64 64 {% url "tag" tag_name=tag page=current_page.previous_page_number %}
65 65 {% elif archived %}
66 66 {% url "archive" page=current_page.previous_page_number %}
67 67 {% else %}
68 68 {% url "index" page=current_page.previous_page_number %}
69 69 {% endif %}
70 70 ">{% trans "Previous page" %}</a>
71 71 </div>
72 72 {% endif %}
73 73
74 74 {% for thread in threads %}
75 75 {% cache 600 thread_short thread.id thread.last_edit_time moderator LANGUAGE_CODE %}
76 76 <div class="thread">
77 {% post_view_truncated thread.get_opening_post True moderator %}
77 {% with can_bump=thread.can_bump %}
78 {% post_view_truncated thread.get_opening_post True moderator is_opening=True thread=thread can_bump=can_bump %}
78 79 {% if not thread.archived %}
79 80 {% if thread.get_last_replies.exists %}
80 81 {% if thread.get_skipped_replies_count %}
81 82 <div class="skipped_replies">
82 83 <a href="{% url 'thread' thread.get_opening_post.id %}">
83 84 {% blocktrans with count=thread.get_skipped_replies_count %}Skipped {{ count }} replies. Open thread to see all replies.{% endblocktrans %}
84 85 </a>
85 86 </div>
86 87 {% endif %}
87 88 <div class="last-replies">
88 89 {% for post in thread.get_last_replies %}
89 {% post_view_truncated post moderator=moderator%}
90 {% post_view_truncated post moderator=moderator is_opening=False thread=thread can_bump=can_bump %}
90 91 {% endfor %}
91 92 </div>
92 93 {% endif %}
93 94 {% endif %}
95 {% endwith %}
94 96 </div>
95 97 {% endcache %}
96 98 {% endfor %}
97 99
98 100 {% if current_page.has_next %}
99 101 <div class="page_link">
100 102 <a href="
101 103 {% if tag %}
102 104 {% url "tag" tag_name=tag page=current_page.next_page_number %}
103 105 {% elif archived %}
104 106 {% url "archive" page=current_page.next_page_number %}
105 107 {% else %}
106 108 {% url "index" page=current_page.next_page_number %}
107 109 {% endif %}
108 110 ">{% trans "Next page" %}</a>
109 111 </div>
110 112 {% endif %}
111 113 {% else %}
112 114 <div class="post">
113 115 {% trans 'No threads exist. Create the first one!' %}</div>
114 116 {% endif %}
115 117
116 118 <div class="post-form-w">
117 119 <script src="{% static 'js/panel.js' %}"></script>
118 120 <div class="post-form">
119 121 <div class="form-title">{% trans "Create new thread" %}</div>
120 122 <form enctype="multipart/form-data" method="post">{% csrf_token %}
121 123 {{ form.as_div }}
122 124 <div class="form-submit">
123 125 <input type="submit" value="{% trans "Post" %}"/>
124 126 </div>
125 127 </form>
126 128 <div>
127 129 {% trans 'Tags must be delimited by spaces. Text or image is required.' %}
128 130 </div>
129 131 <div><a href="{% url "staticpage" name="help" %}">
130 132 {% trans 'Text syntax' %}</a></div>
131 133 </div>
132 134 </div>
133 135
134 136 {% endblock %}
135 137
136 138 {% block metapanel %}
137 139
138 140 <span class="metapanel">
139 141 <b><a href="{% url "authors" %}">{{ site_name }}</a> {{ version }}</b>
140 142 {% trans "Pages:" %}[
141 143 {% for page in paginator.page_range %}
142 144 <a
143 145 {% ifequal page current_page.number %}
144 146 class="current_page"
145 147 {% endifequal %}
146 148 href="
147 149 {% if tag %}
148 150 {% url "tag" tag_name=tag page=page %}
149 151 {% elif archived %}
150 152 {% url "archive" page=page %}
151 153 {% else %}
152 154 {% url "index" page=page %}
153 155 {% endif %}
154 156 ">{{ page }}</a>
155 157 {% if not forloop.last %},{% endif %}
156 158 {% endfor %}
157 159 ]
158 160 [<a href="rss/">RSS</a>]
159 161 </span>
160 162
161 163 {% endblock %}
@@ -1,82 +1,88 b''
1 1 {% extends "boards/base.html" %}
2 2
3 3 {% load i18n %}
4 4 {% load cache %}
5 5 {% load static from staticfiles %}
6 6 {% load board %}
7 7
8 8 {% block head %}
9 9 <title>{{ opening_post.get_title|striptags|truncatewords:10 }}
10 10 - {{ site_name }}</title>
11 11 {% endblock %}
12 12
13 13 {% block content %}
14 14 {% spaceless %}
15 15 {% get_current_language as LANGUAGE_CODE %}
16 16
17 17 {% cache 600 thread_view thread.id thread.last_edit_time moderator LANGUAGE_CODE %}
18 18
19 19 <div class="image-mode-tab">
20 20 <a class="current_mode" href="{% url 'thread' opening_post.id %}">{% trans 'Normal mode' %}</a>,
21 21 <a href="{% url 'thread_mode' opening_post.id 'gallery' %}">{% trans 'Gallery mode' %}</a>
22 22 </div>
23 23
24 24 {% if bumpable %}
25 25 <div class="bar-bg">
26 26 <div class="bar-value" style="width:{{ bumplimit_progress }}%" id="bumplimit_progress">
27 27 </div>
28 28 <div class="bar-text">
29 29 <span id="left_to_limit">{{ posts_left }}</span> {% trans 'posts to bumplimit' %}
30 30 </div>
31 31 </div>
32 32 {% endif %}
33 33
34 34 <div class="thread">
35 {% with can_bump=thread.can_bump %}
35 36 {% for post in thread.get_replies %}
36 {% post_view post moderator=moderator %}
37 {% if forloop.first %}
38 {% post_view post moderator=moderator is_opening=True thread=thread can_bump=can_bump %}
39 {% else %}
40 {% post_view post moderator=moderator is_opening=False thread=thread can_bump=can_bump %}
41 {% endif %}
37 42 {% endfor %}
43 {% endwith %}
38 44 </div>
39 45
40 46 {% if not thread.archived %}
41 47
42 48 <div class="post-form-w">
43 49 <script src="{% static 'js/panel.js' %}"></script>
44 50 <div class="form-title">{% trans "Reply to thread" %} #{{ opening_post.id }}</div>
45 51 <div class="post-form">
46 52 <form id="form" enctype="multipart/form-data" method="post"
47 53 >{% csrf_token %}
48 54 {{ form.as_div }}
49 55 <div class="form-submit">
50 56 <input type="submit" value="{% trans "Post" %}"/>
51 57 </div>
52 58 </form>
53 59 <div><a href="{% url "staticpage" name="help" %}">
54 60 {% trans 'Text syntax' %}</a></div>
55 61 </div>
56 62 </div>
57 63
58 64 <script src="{% static 'js/jquery.form.min.js' %}"></script>
59 65 <script src="{% static 'js/thread_update.js' %}"></script>
60 66 {% endif %}
61 67
62 68 <script src="{% static 'js/thread.js' %}"></script>
63 69
64 70 {% endcache %}
65 71
66 72 {% endspaceless %}
67 73 {% endblock %}
68 74
69 75 {% block metapanel %}
70 76
71 77 {% get_current_language as LANGUAGE_CODE %}
72 78
73 79 <span class="metapanel" data-last-update="{{ last_update }}">
74 80 {% cache 600 thread_meta thread.last_edit_time moderator LANGUAGE_CODE %}
75 81 <span id="reply-count">{{ thread.get_reply_count }}</span> {% trans 'replies' %},
76 82 <span id="image-count">{{ thread.get_images_count }}</span> {% trans 'images' %}.
77 83 {% trans 'Last update: ' %}<span id="last-update">{{ thread.last_edit_time }}</span>
78 84 [<a href="rss/">RSS</a>]
79 85 {% endcache %}
80 86 </span>
81 87
82 88 {% endblock %}
@@ -1,76 +1,112 b''
1 1 from django.core.urlresolvers import reverse
2 2 from django.shortcuts import get_object_or_404
3 3 from boards.models import Post
4 4 from boards.views import thread, api
5 5 from django import template
6 6
7 7 register = template.Library()
8 8
9 9 actions = [
10 10 {
11 11 'name': 'google',
12 12 'link': 'http://google.com/searchbyimage?image_url=%s',
13 13 },
14 14 {
15 15 'name': 'iqdb',
16 16 'link': 'http://iqdb.org/?url=%s',
17 17 },
18 18 ]
19 19
20 20
21 21 @register.simple_tag(name='post_url')
22 22 def post_url(*args, **kwargs):
23 23 post_id = args[0]
24 24
25 25 post = get_object_or_404(Post, id=post_id)
26 26
27 27 if not post.is_opening():
28 28 link = reverse('thread', kwargs={
29 29 'post_id': post.thread_new.get_opening_post().id}) + '#' + str(
30 30 post_id)
31 31 else:
32 32 link = reverse('thread', kwargs={'post_id': post_id})
33 33
34 34 return link
35 35
36 36
37 37 @register.simple_tag(name='image_actions')
38 38 def image_actions(*args, **kwargs):
39 39 image_link = args[0]
40 40 if len(args) > 1:
41 41 image_link = 'http://' + args[1] + image_link # TODO https?
42 42
43 43 result = ''
44 44
45 45 for action in actions:
46 46 result += '[<a href="' + action['link'] % image_link + '">' + \
47 47 action['name'] + '</a>]'
48 48
49 49 return result
50 50
51 51
52 52 @register.inclusion_tag('boards/post.html', name='post_view')
53 def post_view(post, moderator=False):
53 def post_view(post, moderator=False, **kwargs):
54 54 """
55 55 Get post
56 56 """
57 57
58 if 'is_opening' in kwargs:
59 is_opening = kwargs['is_opening']
60 else:
61 is_opening = post.is_opening()
62
63 if 'thread' in kwargs:
64 thread = kwargs['thread']
65 else:
66 thread = post.thread_new
67
68 if 'can_bump' in kwargs:
69 can_bump = kwargs['can_bump']
70 else:
71 can_bump = thread.can_bump()
72
58 73 return {
59 74 'post': post,
60 75 'moderator': moderator,
76 'is_opening': is_opening,
77 'thread': thread,
78 'bumpable': can_bump,
61 79 }
62 80
63 81
64 82 @register.inclusion_tag('boards/post.html', name='post_view_truncated')
65 def post_view_truncated(post, need_open_link=False, moderator=False):
83 def post_view_truncated(post, need_open_link=False, moderator=False, **kwargs):
66 84 """
67 85 Get post with truncated text. If the 'open' or 'reply' link is needed, pass
68 86 the second parameter as True.
69 87 """
70 88
89 if 'is_opening' in kwargs:
90 is_opening = kwargs['is_opening']
91 else:
92 is_opening = post.is_opening()
93
94 if 'thread' in kwargs:
95 thread = kwargs['thread']
96 else:
97 thread = post.thread_new
98
99 if 'can_bump' in kwargs:
100 can_bump = kwargs['can_bump']
101 else:
102 can_bump = thread.can_bump()
103
71 104 return {
72 105 'post': post,
73 106 'truncated': True,
74 107 'need_open_link': need_open_link,
75 108 'moderator': moderator,
109 'is_opening': is_opening,
110 'thread': thread,
111 'bumpable': can_bump,
76 112 }
@@ -1,249 +1,252 b''
1 1 # Django settings for neboard project.
2 2 import os
3 3 from boards.mdx_neboard import markdown_extended
4 4
5 5 DEBUG = True
6 6 TEMPLATE_DEBUG = DEBUG
7 7
8 8 ADMINS = (
9 9 # ('Your Name', 'your_email@example.com'),
10 10 ('admin', 'admin@example.com')
11 11 )
12 12
13 13 MANAGERS = ADMINS
14 14
15 15 DATABASES = {
16 16 'default': {
17 17 'ENGINE': 'django.db.backends.sqlite3', # Add 'postgresql_psycopg2', 'mysql', 'sqlite3' or 'oracle'.
18 18 'NAME': 'database.db', # Or path to database file if using sqlite3.
19 19 'USER': '', # Not used with sqlite3.
20 20 'PASSWORD': '', # Not used with sqlite3.
21 21 'HOST': '', # Set to empty string for localhost. Not used with sqlite3.
22 22 'PORT': '', # Set to empty string for default. Not used with sqlite3.
23 23 'CONN_MAX_AGE': None,
24 24 }
25 25 }
26 26
27 27 # Local time zone for this installation. Choices can be found here:
28 28 # http://en.wikipedia.org/wiki/List_of_tz_zones_by_name
29 29 # although not all choices may be available on all operating systems.
30 30 # In a Windows environment this must be set to your system time zone.
31 31 TIME_ZONE = 'Europe/Kiev'
32 32
33 33 # Language code for this installation. All choices can be found here:
34 34 # http://www.i18nguy.com/unicode/language-identifiers.html
35 35 LANGUAGE_CODE = 'en'
36 36
37 37 SITE_ID = 1
38 38
39 39 # If you set this to False, Django will make some optimizations so as not
40 40 # to load the internationalization machinery.
41 41 USE_I18N = True
42 42
43 43 # If you set this to False, Django will not format dates, numbers and
44 44 # calendars according to the current locale.
45 45 USE_L10N = True
46 46
47 47 # If you set this to False, Django will not use timezone-aware datetimes.
48 48 USE_TZ = True
49 49
50 50 # Absolute filesystem path to the directory that will hold user-uploaded files.
51 51 # Example: "/home/media/media.lawrence.com/media/"
52 52 MEDIA_ROOT = './media/'
53 53
54 54 # URL that handles the media served from MEDIA_ROOT. Make sure to use a
55 55 # trailing slash.
56 56 # Examples: "http://media.lawrence.com/media/", "http://example.com/media/"
57 57 MEDIA_URL = '/media/'
58 58
59 59 # Absolute path to the directory static files should be collected to.
60 60 # Don't put anything in this directory yourself; store your static files
61 61 # in apps' "static/" subdirectories and in STATICFILES_DIRS.
62 62 # Example: "/home/media/media.lawrence.com/static/"
63 63 STATIC_ROOT = ''
64 64
65 65 # URL prefix for static files.
66 66 # Example: "http://media.lawrence.com/static/"
67 67 STATIC_URL = '/static/'
68 68
69 69 # Additional locations of static files
70 70 # It is really a hack, put real paths, not related
71 71 STATICFILES_DIRS = (
72 72 os.path.dirname(__file__) + '/boards/static',
73 73
74 74 # '/d/work/python/django/neboard/neboard/boards/static',
75 75 # Put strings here, like "/home/html/static" or "C:/www/django/static".
76 76 # Always use forward slashes, even on Windows.
77 77 # Don't forget to use absolute paths, not relative paths.
78 78 )
79 79
80 80 # List of finder classes that know how to find static files in
81 81 # various locations.
82 82 STATICFILES_FINDERS = (
83 83 'django.contrib.staticfiles.finders.FileSystemFinder',
84 84 'django.contrib.staticfiles.finders.AppDirectoriesFinder',
85 85 )
86 86
87 87 if DEBUG:
88 88 STATICFILES_STORAGE = \
89 89 'django.contrib.staticfiles.storage.StaticFilesStorage'
90 90 else:
91 91 STATICFILES_STORAGE = \
92 92 'django.contrib.staticfiles.storage.CachedStaticFilesStorage'
93 93
94 94 # Make this unique, and don't share it with anybody.
95 95 SECRET_KEY = '@1rc$o(7=tt#kd+4s$u6wchm**z^)4x90)7f6z(i&amp;55@o11*8o'
96 96
97 97 # List of callables that know how to import templates from various sources.
98 98 TEMPLATE_LOADERS = (
99 99 'django.template.loaders.filesystem.Loader',
100 100 'django.template.loaders.app_directories.Loader',
101 101 )
102 102
103 103 TEMPLATE_CONTEXT_PROCESSORS = (
104 104 'django.core.context_processors.media',
105 105 'django.core.context_processors.static',
106 106 'django.core.context_processors.request',
107 107 'django.contrib.auth.context_processors.auth',
108 108 )
109 109
110 110 MIDDLEWARE_CLASSES = (
111 111 'django.contrib.sessions.middleware.SessionMiddleware',
112 112 'django.middleware.locale.LocaleMiddleware',
113 113 'django.middleware.common.CommonMiddleware',
114 114 'django.contrib.auth.middleware.AuthenticationMiddleware',
115 115 'django.contrib.messages.middleware.MessageMiddleware',
116 116 'boards.middlewares.BanMiddleware',
117 117 'boards.middlewares.MinifyHTMLMiddleware',
118 118 )
119 119
120 120 ROOT_URLCONF = 'neboard.urls'
121 121
122 122 # Python dotted path to the WSGI application used by Django's runserver.
123 123 WSGI_APPLICATION = 'neboard.wsgi.application'
124 124
125 125 TEMPLATE_DIRS = (
126 126 # Put strings here, like "/home/html/django_templates" or "C:/www/django/templates".
127 127 # Always use forward slashes, even on Windows.
128 128 # Don't forget to use absolute paths, not relative paths.
129 129 'templates',
130 130 )
131 131
132 132 INSTALLED_APPS = (
133 133 'django.contrib.auth',
134 134 'django.contrib.contenttypes',
135 135 'django.contrib.sessions',
136 136 # 'django.contrib.sites',
137 137 'django.contrib.messages',
138 138 'django.contrib.staticfiles',
139 139 # Uncomment the next line to enable the admin:
140 140 'django.contrib.admin',
141 141 # Uncomment the next line to enable admin documentation:
142 142 # 'django.contrib.admindocs',
143 143 'django.contrib.humanize',
144 144 'django_cleanup',
145 145 'boards',
146 146 'captcha',
147 147 'south',
148 148 'debug_toolbar',
149 149 )
150 150
151 151 DEBUG_TOOLBAR_PANELS = (
152 152 'debug_toolbar.panels.version.VersionDebugPanel',
153 153 'debug_toolbar.panels.timer.TimerDebugPanel',
154 154 'debug_toolbar.panels.settings_vars.SettingsVarsDebugPanel',
155 155 'debug_toolbar.panels.headers.HeaderDebugPanel',
156 156 'debug_toolbar.panels.request_vars.RequestVarsDebugPanel',
157 157 'debug_toolbar.panels.template.TemplateDebugPanel',
158 158 'debug_toolbar.panels.sql.SQLDebugPanel',
159 159 'debug_toolbar.panels.signals.SignalDebugPanel',
160 160 'debug_toolbar.panels.logger.LoggingPanel',
161 161 )
162 162
163 163 # TODO: NEED DESIGN FIXES
164 164 CAPTCHA_OUTPUT_FORMAT = (u' %(hidden_field)s '
165 165 u'<div class="form-label">%(image)s</div>'
166 166 u'<div class="form-text">%(text_field)s</div>')
167 167
168 168 # A sample logging configuration. The only tangible logging
169 169 # performed by this configuration is to send an email to
170 170 # the site admins on every HTTP 500 error when DEBUG=False.
171 171 # See http://docs.djangoproject.com/en/dev/topics/logging for
172 172 # more details on how to customize your logging configuration.
173 173 LOGGING = {
174 174 'version': 1,
175 175 'disable_existing_loggers': False,
176 176 'filters': {
177 177 'require_debug_false': {
178 178 '()': 'django.utils.log.RequireDebugFalse'
179 179 }
180 180 },
181 181 'handlers': {
182 182 'mail_admins': {
183 183 'level': 'ERROR',
184 184 'filters': ['require_debug_false'],
185 185 'class': 'django.utils.log.AdminEmailHandler'
186 186 }
187 187 },
188 188 'loggers': {
189 189 'django.request': {
190 190 'handlers': ['mail_admins'],
191 191 'level': 'ERROR',
192 192 'propagate': True,
193 193 },
194 194 }
195 195 }
196 196
197 197 MARKUP_FIELD_TYPES = (
198 198 ('markdown', markdown_extended),
199 199 )
200 200 # Custom imageboard settings
201 201 # TODO These should me moved to
202 202 MAX_POSTS_PER_THREAD = 10 # Thread bumplimit
203 203 MAX_THREAD_COUNT = 500 # Old threads will be deleted to preserve this count
204 204 THREADS_PER_PAGE = 3
205 205 SITE_NAME = 'Neboard'
206 206
207 207 THEMES = [
208 208 ('md', 'Mystic Dark'),
209 209 ('md_centered', 'Mystic Dark (centered)'),
210 210 ('sw', 'Snow White'),
211 211 ('pg', 'Photon Gray'),
212 212 ]
213 213
214 214 DEFAULT_THEME = 'md'
215 215
216 216 POPULAR_TAGS = 10
217 217 LAST_REPLIES_COUNT = 3
218 218
219 219 ENABLE_CAPTCHA = False
220 220 # if user tries to post before CAPTCHA_DEFAULT_SAFE_TIME. Captcha will be shown
221 221 CAPTCHA_DEFAULT_SAFE_TIME = 30 # seconds
222 222 POSTING_DELAY = 20 # seconds
223 223
224 224 COMPRESS_HTML = True
225 225
226 226 VERSION = '1.7 Anubis'
227 227
228 228 # Debug mode middlewares
229 229 if DEBUG:
230
231 SITE_NAME += '_debug'
232
230 233 MIDDLEWARE_CLASSES += (
231 234 'boards.profiler.ProfilerMiddleware',
232 235 'debug_toolbar.middleware.DebugToolbarMiddleware',
233 236 )
234 237
235 238 def custom_show_toolbar(request):
236 239 return DEBUG
237 240
238 241 DEBUG_TOOLBAR_CONFIG = {
239 242 'INTERCEPT_REDIRECTS': False,
240 243 'SHOW_TOOLBAR_CALLBACK': custom_show_toolbar,
241 244 'HIDE_DJANGO_SQL': False,
242 245 'ENABLE_STACKTRACES': True,
243 246 }
244 247
245 248 # FIXME Uncommenting this fails somehow. Need to investigate this
246 249 #DEBUG_TOOLBAR_PANELS += (
247 250 # 'debug_toolbar.panels.profiling.ProfilingDebugPanel',
248 251 #)
249 252
General Comments 0
You need to be logged in to leave comments. Login now