本文整理汇总了Python中django.http.request.HttpRequest.GET方法的典型用法代码示例。如果您正苦于以下问题:Python HttpRequest.GET方法的具体用法?Python HttpRequest.GET怎么用?Python HttpRequest.GET使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类django.http.request.HttpRequest
的用法示例。
在下文中一共展示了HttpRequest.GET方法的3个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。
示例1: test_response_whitout_message_and_querystring
# 需要导入模块: from django.http.request import HttpRequest [as 别名]
# 或者: from django.http.request.HttpRequest import GET [as 别名]
def test_response_whitout_message_and_querystring(self):
from django.contrib.messages.storage import default_storage
request = HttpRequest()
request.GET = QueryDict('test=asd')
request.session = SessionStore('asd')
request._messages = default_storage(request)
response = easy.action_response(request, keep_querystring=False)
self.assertEqual(len(request._messages._queued_messages), 0)
self.assertEqual(response.status_code, 302)
self.assertEqual(response['Location'], '.')
示例2: test_response_normal
# 需要导入模块: from django.http.request import HttpRequest [as 别名]
# 或者: from django.http.request.HttpRequest import GET [as 别名]
def test_response_normal(self):
from django.contrib.messages.storage import default_storage
request = HttpRequest()
request.GET = QueryDict('test=asd')
request.session = SessionStore('asd')
request._messages = default_storage(request)
response = easy.action_response(request, 'Some message')
self.assertEqual(len(request._messages._queued_messages), 1)
self.assertEqual(response.status_code, 302)
self.assertEqual(response['Location'], './?test=asd')
示例3: is_module_managing_occurencies
# 需要导入模块: from django.http.request import HttpRequest [as 别名]
# 或者: from django.http.request.HttpRequest import GET [as 别名]
def is_module_managing_occurencies(module):
request = HttpRequest()
request.method = 'GET'
request.GET = {
'url': module.url,
'module_id': module.id,
'managing_occurences': True
}
module_view = get_module_view(module.url)
response = module_view(request).content.decode("utf-8")
if response == 'false':
return False
elif response == 'true':
return True
else:
raise ValueError("Unexpected value (expected 'true'|'false', got {})".format(response))