本文整理汇总了Python中topic.models.Topic.clicks方法的典型用法代码示例。如果您正苦于以下问题:Python Topic.clicks方法的具体用法?Python Topic.clicks怎么用?Python Topic.clicks使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类topic.models.Topic
的用法示例。
在下文中一共展示了Topic.clicks方法的1个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。
示例1: visit_corporation_topics
# 需要导入模块: from topic.models import Topic [as 别名]
# 或者: from topic.models.Topic import clicks [as 别名]
def visit_corporation_topics(request, gurl_number):
corporation = Corporation.objects(url_number=gurl_number).get()
if request.method == "POST":
form = NewTopicForm(request.POST)
if form.is_valid():
title = form.cleaned_data['title']
content = form.cleaned_data['content']
topic = Topic(title=title)
turl_number = len(Topic.objects) + 1
topic.url_number = turl_number
topic.content = content
topic.creat_time = datetime.datetime.now()
topic.is_active = True
topic.is_locked = False
topic.is_top = False
topic.clicks = 0
topic.update_time = datetime.datetime.now()
topic.update_author = request.user
sccard = S_C_Card.objects(user=request.user, corporation=corporation).get()
topic.creator = sccard
topic.save()
return HttpResponseRedirect('/corporation/' + str(gurl_number) + '/topic/' + str(turl_number) + '/')
else:
form = NewTopicForm()
return render_to_response('corporation/corporation_topics.html', {'form':form, 'corporation':corporation, 'STATIC_URL':STATIC_URL, 'current_user':request.user}, context_instance=RequestContext(request))