##// END OF EJS Templates
Closed branch
Closed branch

File last commit:

r730:447bb8d7 2.0-dev
r737:5038e91b 1.8-dev
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