本文整理汇总了Python中django.contrib.messages.constants.DEFAULT_LEVELS属性的典型用法代码示例。如果您正苦于以下问题:Python constants.DEFAULT_LEVELS属性的具体用法?Python constants.DEFAULT_LEVELS怎么用?Python constants.DEFAULT_LEVELS使用的例子?那么, 这里精选的属性代码示例或许可以为您提供帮助。您也可以进一步了解该属性所在类django.contrib.messages.constants
的用法示例。
在下文中一共展示了constants.DEFAULT_LEVELS属性的4个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。
示例1: messages
# 需要导入模块: from django.contrib.messages import constants [as 别名]
# 或者: from django.contrib.messages.constants import DEFAULT_LEVELS [as 别名]
def messages(request):
"""
Returns a lazy 'messages' context variable.
"""
return {
'messages': get_messages(request),
'DEFAULT_MESSAGE_LEVELS': DEFAULT_LEVELS,
}
示例2: messages
# 需要导入模块: from django.contrib.messages import constants [as 别名]
# 或者: from django.contrib.messages.constants import DEFAULT_LEVELS [as 别名]
def messages(request):
"""
Return a lazy 'messages' context variable as well as
'DEFAULT_MESSAGE_LEVELS'.
"""
return {
'messages': get_messages(request),
'DEFAULT_MESSAGE_LEVELS': DEFAULT_LEVELS,
}
示例3: messages
# 需要导入模块: from django.contrib.messages import constants [as 别名]
# 或者: from django.contrib.messages.constants import DEFAULT_LEVELS [as 别名]
def messages(request):
"""
Return a lazy 'messages' context variable as well as
'DEFAULT_MESSAGE_LEVELS'.
"""
return {
"messages": get_messages(request=request),
"DEFAULT_MESSAGE_LEVELS": DEFAULT_LEVELS,
}
示例4: test_context_processor_message_levels
# 需要导入模块: from django.contrib.messages import constants [as 别名]
# 或者: from django.contrib.messages.constants import DEFAULT_LEVELS [as 别名]
def test_context_processor_message_levels(self):
show_url = reverse('show_template_response')
response = self.client.get(show_url)
self.assertIn('DEFAULT_MESSAGE_LEVELS', response.context)
self.assertEqual(response.context['DEFAULT_MESSAGE_LEVELS'], DEFAULT_LEVELS)