當前位置: 首頁>>代碼示例>>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;未經允許,請勿轉載。