本文整理汇总了Python中messages.Messages.get方法的典型用法代码示例。如果您正苦于以下问题:Python Messages.get方法的具体用法?Python Messages.get怎么用?Python Messages.get使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类messages.Messages
的用法示例。
在下文中一共展示了Messages.get方法的1个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。
示例1: render
# 需要导入模块: from messages import Messages [as 别名]
# 或者: from messages.Messages import get [as 别名]
def render(self, template_name, data={}):
"""Renders the template in the site wide manner.
Retrieves the template data needed for the base template (login URL and
text, user information, etc.) and merges it with the data passed to the
method. Templates are retrieved from the template directory specified
in the settings and appended with the suffix ".html"
Arguments:
template_name: the name of the template. this is the file name of the
template without the .html extension.
data: a dictionary containing data to be passed to the template.
"""
(login_text, login_url) = auth.login_logout(self.request)
if auth.logged_in():
data['user'] = auth.User(auth.current_user())
data['admin'] = auth.user_is_admin()
data['login_url'] = login_url
data['login_text'] = login_text
data['messages'] = Messages.get()
path = os.path.join(settings.BASE_DIR, settings.TEMPLATE_DIR,
"%s.html" % template_name)
return self.response.out.write(template.render(path, data))