def get_theme(): _themes = dict((k.lower(), v) for k, v in themes.items()) theme = session.get('theme_name') if not theme: theme = storage.get_setting('theme_name') if not theme: theme = 'flat ui' storage.set_setting('theme_name', theme) return dict(current_theme_name=theme, current_theme_url=_themes[theme])
def set_theme(): theme_name = request.form['theme'].lower() _themes = dict((k.lower(), v) for k, v in themes.items()) if not theme_name in _themes.keys(): return jsonify(success=False, output='Theme not exists') storage.set_setting('theme_name', theme_name) session['theme_name'] = theme_name return jsonify(success=True, output='Theme changed')