##// END OF EJS Templates
Added banner to show the site news. Returned the message middleware because it...
Added banner to show the site news. Returned the message middleware because it is required to add models over admin site

File last commit:

r1055:e5eaf6eb default
r1148:94091a42 default
Show More
normal.py
31 lines | 874 B | text/x-python | PythonLexer
from boards import settings
from boards.views.thread import ThreadView
TEMPLATE_NORMAL = 'boards/thread_normal.html'
CONTEXT_OP = 'opening_post'
CONTEXT_BUMPLIMIT_PRG = 'bumplimit_progress'
CONTEXT_POSTS_LEFT = 'posts_left'
CONTEXT_BUMPABLE = 'bumpable'
class NormalThreadView(ThreadView):
def get_template(self):
return TEMPLATE_NORMAL
def get_data(self, thread):
params = dict()
bumpable = thread.can_bump()
params[CONTEXT_BUMPABLE] = bumpable
max_posts = thread.max_posts
if bumpable and thread.has_post_limit():
left_posts = max_posts - thread.get_reply_count()
params[CONTEXT_POSTS_LEFT] = left_posts
params[CONTEXT_BUMPLIMIT_PRG] = str(
float(left_posts) / max_posts * 100)
params[CONTEXT_OP] = thread.get_opening_post()
return params