当前位置: 首页>>代码示例>>Python>>正文


Python storage.default_storage方法代码示例

本文整理汇总了Python中django.contrib.messages.storage.default_storage方法的典型用法代码示例。如果您正苦于以下问题:Python storage.default_storage方法的具体用法?Python storage.default_storage怎么用?Python storage.default_storage使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在django.contrib.messages.storage的用法示例。


在下文中一共展示了storage.default_storage方法的7个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。

示例1: get_level

# 需要导入模块: from django.contrib.messages import storage [as 别名]
# 或者: from django.contrib.messages.storage import default_storage [as 别名]
def get_level(request):
    """
    Returns the minimum level of messages to be recorded.

    The default level is the ``MESSAGE_LEVEL`` setting. If this is not found,
    the ``INFO`` level is used.
    """
    if hasattr(request, '_messages'):
        storage = request._messages
    else:
        storage = default_storage(request)
    return storage.level 
开发者ID:ComputerSocietyUNB,项目名称:CodingDojo,代码行数:14,代码来源:api.py

示例2: process_request

# 需要导入模块: from django.contrib.messages import storage [as 别名]
# 或者: from django.contrib.messages.storage import default_storage [as 别名]
def process_request(self, request):
        request._messages = default_storage(request) 
开发者ID:ComputerSocietyUNB,项目名称:CodingDojo,代码行数:4,代码来源:middleware.py

示例3: get_level

# 需要导入模块: from django.contrib.messages import storage [as 别名]
# 或者: from django.contrib.messages.storage import default_storage [as 别名]
def get_level(request):
    """
    Returns the minimum level of messages to be recorded.

    The default level is the ``MESSAGE_LEVEL`` setting. If this is not found,
    the ``INFO`` level is used.
    """
    storage = getattr(request, '_messages', default_storage(request))
    return storage.level 
开发者ID:KimJangHyeon,项目名称:NarshaTech,代码行数:11,代码来源:api.py

示例4: _post_request

# 需要导入模块: from django.contrib.messages import storage [as 别名]
# 或者: from django.contrib.messages.storage import default_storage [as 别名]
def _post_request(self, user):
        data = {
            'plugin_type': 'TextPlugin',
            'placeholder_id': self._placeholder.pk,
            'plugin_language': 'en',
        }
        request = self.get_post_request(data)
        request.user = self.reload(user)
        request._messages = default_storage(request)
        return request 
开发者ID:farhan711,项目名称:DjangoCMS,代码行数:12,代码来源:test_placeholder.py

示例5: test_create_message_mixin

# 需要导入模块: from django.contrib.messages import storage [as 别名]
# 或者: from django.contrib.messages.storage import default_storage [as 别名]
def test_create_message_mixin(self):
        request = self.factory.post('/fake-path', {
            'username': 'gclooney',
            'email': '[email protected]',
        })
        request._messages = default_storage(request)
        CreateMessageView.as_view()(request)

        self.assertEqual(len(get_messages(request)), 1) 
开发者ID:cubope,项目名称:django-boilerplate,代码行数:11,代码来源:tests.py

示例6: test_update_message_mixin

# 需要导入模块: from django.contrib.messages import storage [as 别名]
# 或者: from django.contrib.messages.storage import default_storage [as 别名]
def test_update_message_mixin(self):
        request = self.factory.post('/fake-path', {
            'username': 'gclooney',
            'email': '[email protected]',
        })
        request._messages = default_storage(request)
        UpdateMessageView.as_view()(request)

        self.assertEqual(len(get_messages(request)), 1) 
开发者ID:cubope,项目名称:django-boilerplate,代码行数:11,代码来源:tests.py

示例7: test_delete_message_mixin

# 需要导入模块: from django.contrib.messages import storage [as 别名]
# 或者: from django.contrib.messages.storage import default_storage [as 别名]
def test_delete_message_mixin(self):
        request = self.factory.post('/fake-path', {})
        request._messages = default_storage(request)
        DeleteMessageView.as_view()(request)

        self.assertEqual(len(get_messages(request)), 1) 
开发者ID:cubope,项目名称:django-boilerplate,代码行数:8,代码来源:tests.py


注:本文中的django.contrib.messages.storage.default_storage方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。