• 设为首页
  • 点击收藏
  • 手机版
    手机扫一扫访问
    迪恩网络手机版
  • 关注官方公众号
    微信扫一扫关注
    公众号

Python models.Topic类代码示例

原作者: [db:作者] 来自: [db:来源] 收藏 邀请

本文整理汇总了Python中topic.models.Topic的典型用法代码示例。如果您正苦于以下问题:Python Topic类的具体用法?Python Topic怎么用?Python Topic使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。



在下文中一共展示了Topic类的13个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的Python代码示例。

示例1: showtopic

def showtopic(request, gurl_number, turl_number):
    group = Group.objects(url_number=gurl_number).get()
    topic = Topic.objects(url_number=turl_number).get()
    topic.clicks = topic.clicks + 1
    topic.save()
    if request.method == 'POST':
        if "reply" in request.POST:
            reply_form = NewReplyForm(request.POST)
            if reply_form.is_valid():
                content = reply_form.cleaned_data['content']
                reply = Reply(content=content)
                sgcard = S_G_Card.objects(user=request.user, group=group).get()
                reply.creator = sgcard
                reply.creat_time = datetime.datetime.now()
                reply.target = topic
                reply.is_active = True
                reply.save()
                topic.update_author = request.user
                topic.update_time = datetime.datetime.now()
                topic.clicks = topic.clicks - 1
                topic.save()
                return HttpResponseRedirect('/group/' + str(gurl_number) + '/topic/' + str(turl_number) + '/')
            
        if "modify" in request.POST:
            modify_form = ModifyTopicForm(request.POST)
            if modify_form.is_valid():
                content = modify_form.cleaned_data['content']
                topic.content = content
                topic.clicks = topic.clicks - 1
                topic.save()
                return HttpResponseRedirect('/group/' + str(gurl_number) + '/topic/' + str(turl_number) + '/')
        
    else:
        reply_form = NewReplyForm()
        modify_form = ModifyTopicForm()
        topic.clicks = topic.clicks + 1
        topic.save()
        return render_to_response('group/group_topic.html', {'group':group, 'current_user':request.user, 'reply_form':reply_form, 'topic':topic, 'STATIC_URL':STATIC_URL}, context_instance=RequestContext(request))
开发者ID:NCZkevin,项目名称:pyweb-test,代码行数:38,代码来源:views.py


示例2: showtopic

def showtopic(request, gurl_number, turl_number):
    corporation = Corporation.objects(url_number=gurl_number).get()
    topic = Topic.objects(url_number=turl_number).get()
    topic.clicks += 1
    topic.save()
    if request.method == 'POST':
        form = NewReplyForm(request.POST)
        if form.is_valid():
            content = form.cleaned_data['content']
            reply = Reply(content=content)
            sccard = S_C_Card.objects(user=request.user, corporation=corporation).get()
            reply.creator = sccard
            reply.creat_time = datetime.datetime.now()
            reply.target = topic
            reply.is_active = True
            reply.save()
            topic.update_author = request.user
            topic.update_time = datetime.datetime.now()
            topic.save()
            return HttpResponseRedirect('/corporation/' + str(gurl_number) + '/topic/' + str(turl_number) + '/')
        
    else:
        form = NewReplyForm()
        return render_to_response('corporation/topic_corporation.html', {'corporation':corporation, 'current_user':request.user, 'form':form, 'topic':topic, 'STATIC_URL':STATIC_URL}, context_instance=RequestContext(request))
开发者ID:longshenzhu,项目名称:COC,代码行数:24,代码来源:views.py


示例3: get_topic_not_locked

 def get_topic_not_locked(self):
     from topic.models import Topic
     return Topic.objects(creator__in=self.get_sccard_all(), is_active=True, is_locked=False)
开发者ID:NCZkevin,项目名称:pyweb-test,代码行数:3,代码来源:models.py


示例4: get_topic_top

 def get_topic_top(self):
     from topic.models import Topic
     return Topic.objects(creator__in=self.get_sccard_all(), is_active=True, is_top=True)
开发者ID:NCZkevin,项目名称:pyweb-test,代码行数:3,代码来源:models.py


示例5: get_topic_inactive

 def get_topic_inactive(self):
     from topic.models import Topic
     return Topic.objects(creator__in=self.get_sccard_all(), is_active=False)
开发者ID:NCZkevin,项目名称:pyweb-test,代码行数:3,代码来源:models.py


示例6: find_topic

 def find_topic(self):
     from topic.models import Topic
     return Topic.objects(creator__in=self.find_group())
开发者ID:NCZkevin,项目名称:pyweb-test,代码行数:3,代码来源:models.py


示例7: get_topic_corporation_creat_active

 def get_topic_corporation_creat_active(self):
     from topic.models import Topic
     return Topic.objects(creator__in=self.get_sccard_all(), is_active=True)
开发者ID:NCZkevin,项目名称:pyweb-test,代码行数:3,代码来源:models.py


示例8: get_topic_corporation_active

 def get_topic_corporation_active(self):#我关注的小组的话题
     from topic.models import Topic
     from relations.models import S_C_Card
     return Topic.objects(creator__in=S_C_Card.objects(corporation__in=self.get_corporation_active()), is_active=True)
开发者ID:NCZkevin,项目名称:pyweb-test,代码行数:4,代码来源:models.py


示例9: get_topic_group_creat_active

 def get_topic_group_creat_active(self):#我创建的小组话题(active)
     from topic.models import Topic
     return Topic.objects(creator__in=self.get_sgcard_all(), is_active=True)
开发者ID:NCZkevin,项目名称:pyweb-test,代码行数:3,代码来源:models.py


示例10: get_topic_creat_not_locked

 def get_topic_creat_not_locked(self):
     from topic.models import Topic
     return Topic.objects(creator=self, is_active=True, is_locked=False)
开发者ID:longshenzhu,项目名称:COC,代码行数:3,代码来源:models.py


示例11: get_topic_creat_top

 def get_topic_creat_top(self):
     from topic.models import Topic
     return Topic.objects(creator=self, is_active=True, is_top=True)
开发者ID:longshenzhu,项目名称:COC,代码行数:3,代码来源:models.py


示例12: get_topic_creat_inactive

 def get_topic_creat_inactive(self):
     from topic.models import Topic
     return Topic.objects(creator=self, is_active=False)
开发者ID:longshenzhu,项目名称:COC,代码行数:3,代码来源:models.py


示例13: visit_corporation_topics

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))
开发者ID:longshenzhu,项目名称:COC,代码行数:27,代码来源:views.py



注:本文中的topic.models.Topic类示例由纯净天空整理自Github/MSDocs等源码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。


鲜花

握手

雷人

路过

鸡蛋
该文章已有0人参与评论

请发表评论

全部评论

专题导读
上一篇:
Python tests.topic函数代码示例发布时间:2022-05-27
下一篇:
Python util.get_const_tuple函数代码示例发布时间:2022-05-27
热门推荐
阅读排行榜

扫描微信二维码

查看手机版网站

随时了解更新最新资讯

139-2527-9053

在线客服(服务时间 9:00~18:00)

在线QQ客服
地址:深圳市南山区西丽大学城创智工业园
电邮:jeky_zhao#qq.com
移动电话:139-2527-9053

Powered by 互联科技 X3.4© 2001-2213 极客世界.|Sitemap