##// END OF EJS Templates
Added tag 1.8 for changeset 7f7c33ba6e3f
Added tag 1.8 for changeset 7f7c33ba6e3f

File last commit:

r690:a8dffe47 1.8-dev
r705:fe460c78 default
Show More
context_processors.py
30 lines | 845 B | text/x-python | PythonLexer
/ boards / context_processors.py
neko259
Implemented search over posts. Moved get_user and get_theme to utils module. Use context processors instead of creating context in the base view. Removed unused imports in some modules
r690 from boards import utils
from boards.models import Post
from boards.models.post import SETTING_MODERATE
import neboard
__author__ = 'neko259'
def user_and_ui_processor(request):
context = {}
user = utils.get_user(request)
context['user'] = user
context['tags'] = user.fav_tags.all()
context['posts_per_day'] = float(Post.objects.get_posts_per_day())
theme = utils.get_theme(request, user)
context['theme'] = theme
context['theme_css'] = 'css/' + theme + '/base_page.css'
# This shows the moderator panel
moderate = user.get_setting(SETTING_MODERATE)
if moderate == 'True':
context['moderator'] = user.is_moderator()
else:
context['moderator'] = False
context['version'] = neboard.settings.VERSION
context['site_name'] = neboard.settings.SITE_NAME
return context