context_processors.py
30 lines
| 845 B
| text/x-python
|
PythonLexer
/ boards / context_processors.py
neko259
|
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 |