本文整理汇总了Python中models.News.voice方法的典型用法代码示例。如果您正苦于以下问题:Python News.voice方法的具体用法?Python News.voice怎么用?Python News.voice使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类models.News
的用法示例。
在下文中一共展示了News.voice方法的1个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。
示例1: addNews
# 需要导入模块: from models import News [as 别名]
# 或者: from models.News import voice [as 别名]
def addNews(request):
url=request.POST['url']
news = News()
user = request.user # change to request.user
news.author = user
news.picture = open(request.FILES['picture'].temporary_file_path(), "rb")
news.voice = open(request.FILES['voice'].temporary_file_path(), "rb")#change to data from request
result=urlparse.urlparse(url)
params=urlparse.parse_qs(result.query,True)
gid=params['id']
news.good = Goods.objects(pk=gid[0]).first()
news.save()
return HttpResponse("success")