本文整理匯總了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)