Beispiel #1
0
def history_to_dict(history):
    when = format_date(history['when_'])
    name = history['user_name']
    updater = history['updater_name']
    action = format_season_action(history['season'], history['action'])
    return {'when': when,
            'name': name,
            'updater': updater,
            'action': action}
Beispiel #2
0
app.register_blueprint(schedule.mod)
app.register_blueprint(bbs.mod)
app.register_blueprint(admin.mod)
app.register_blueprint(mobile.mod)

from fcsite import utils
app.jinja_env.filters['datetimeformat_full'] = utils.format_datetime_full
app.jinja_env.filters['datetimeformat'] = utils.format_datetime
app.jinja_env.filters['dateformat'] = utils.format_date
app.jinja_env.filters['timeformat'] = utils.format_time
app.jinja_env.filters['strdateformat'] = utils.format_date_str
app.jinja_env.filters['percentage'] = utils.format_percentage
app.jinja_env.filters['countrate'] = utils.format_countrate
app.jinja_env.filters['nl2br'] = utils.nl2br
app.jinja_env.filters['historyactionformat'] = \
    lambda h: utils.format_season_action(h['season'], h['action'])
app.jinja_env.filters['sortbyrate'] = utils.sortbyrate

app.jinja_env.globals['is_admin'] = \
    lambda: g.user and g.user.is_admin()
app.jinja_env.globals['is_schedule_admin'] = \
    lambda: g.user and g.user.is_schedule_admin()
app.jinja_env.globals['is_member_admin'] = \
    lambda: g.user and g.user.is_member_admin()
app.jinja_env.globals['is_notice_admin'] = \
    lambda: g.user and g.user.is_notice_admin()
app.jinja_env.globals['is_god'] = \
    lambda: g.user and g.user.is_god()
app.jinja_env.globals['admin_navigation_list'] = \
    lambda: admin.get_navigation_list(g.user)
app.jinja_env.globals['mobile_url_for'] = \