本文整理汇总了Python中django.http.request.HttpRequest.POST['movie_name']方法的典型用法代码示例。如果您正苦于以下问题:Python HttpRequest.POST['movie_name']方法的具体用法?Python HttpRequest.POST['movie_name']怎么用?Python HttpRequest.POST['movie_name']使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类django.http.request.HttpRequest
的用法示例。
在下文中一共展示了HttpRequest.POST['movie_name']方法的2个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。
示例1: test_movie_save_post_content_and_redirect
# 需要导入模块: from django.http.request import HttpRequest [as 别名]
# 或者: from django.http.request.HttpRequest import POST['movie_name'] [as 别名]
def test_movie_save_post_content_and_redirect(self):
request = HttpRequest()
request.method = 'POST'
request.POST['movie_name'] = 'Troy'
response = home_page(request)
self.assertEqual(response.status_code, 302)
self.assertEqual(response['location'], "/")
示例2: test_movie_save_post_content_and_return
# 需要导入模块: from django.http.request import HttpRequest [as 别名]
# 或者: from django.http.request.HttpRequest import POST['movie_name'] [as 别名]
def test_movie_save_post_content_and_return(self):
request = HttpRequest()
request.method = 'POST'
request.POST['movie_name'] = 'Troy'
home_page(request)
self.assertEqual(Movie.objects.count(), 1)
self.assertEqual(Movie.objects.first().name, "Troy")