当前位置: 首页>>代码示例>>Python>>正文


Python S_G_Card.objects方法代码示例

本文整理汇总了Python中relations.models.S_G_Card.objects方法的典型用法代码示例。如果您正苦于以下问题:Python S_G_Card.objects方法的具体用法?Python S_G_Card.objects怎么用?Python S_G_Card.objects使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在relations.models.S_G_Card的用法示例。


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

示例1: group

# 需要导入模块: from relations.models import S_G_Card [as 别名]
# 或者: from relations.models.S_G_Card import objects [as 别名]
def group(request, gurl_number):
    group = Group.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
            sgcard = S_G_Card.objects(user=request.user, group=group).get()
            topic.creator = sgcard
            topic.save()
            return HttpResponseRedirect('/group/' + str(gurl_number) + '/topic/' + str(turl_number) + '/')
            
            
    else:
        form = NewTopicForm()
        return render_to_response('group/group.html', {'form':form, 'group':group, 'STATIC_URL':STATIC_URL, 'current_user':request.user}, context_instance=RequestContext(request))
开发者ID:longshenzhu,项目名称:COC,代码行数:29,代码来源:views.py

示例2: entergroup

# 需要导入模块: from relations.models import S_G_Card [as 别名]
# 或者: from relations.models.S_G_Card import objects [as 别名]
 def entergroup(self, user):
     from relations.models import S_G_Card
     if self.get_user_active():
         if S_G_Card.objects(user=user, group=self):
             S_G_Card.objects(user=user, group=self).update(set__is_active=True, set__is_admin=False, set__creat_time=datetime.datetime.now())
         else:
             S_G_Card(user=user, group=self, is_active=True, is_admin=False,creat_time=datetime.datetime.now()).save()
     else:
         if S_G_Card.objects(user=user, group=self):
             S_G_Card.objects(user=user, group=self).update(set__is_active=True, set__is_admin=True,set__creat_time=datetime.datetime.now())
         else:
             S_G_Card(user=user, group=self, is_active=True,is_admin=True, creat_time=datetime.datetime.now()).save()
开发者ID:longshenzhu,项目名称:COC,代码行数:14,代码来源:models.py

示例3: showtopic

# 需要导入模块: from relations.models import S_G_Card [as 别名]
# 或者: from relations.models.S_G_Card import objects [as 别名]
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,代码行数:40,代码来源:views.py

示例4: kick_out

# 需要导入模块: from relations.models import S_G_Card [as 别名]
# 或者: from relations.models.S_G_Card import objects [as 别名]
 def kick_out(self,user_url_number):
     from accounts.models import Student
     from relations.models import S_G_Card
     user = Student.objects(url_number=user_url_number).get()
     S_G_Card.objects(group=self,user=user).update(set__is_active=False)
开发者ID:longshenzhu,项目名称:COC,代码行数:7,代码来源:models.py

示例5: promote

# 需要导入模块: from relations.models import S_G_Card [as 别名]
# 或者: from relations.models.S_G_Card import objects [as 别名]
 def promote(self,user_url_number):
     from accounts.models import Student
     from relations.models import S_G_Card
     user = Student.objects(url_number=user_url_number).get()
     S_G_Card.objects(group=self,user=user).update(set__is_admin=True)
开发者ID:longshenzhu,项目名称:COC,代码行数:7,代码来源:models.py

示例6: get_sgcard_not_admin

# 需要导入模块: from relations.models import S_G_Card [as 别名]
# 或者: from relations.models.S_G_Card import objects [as 别名]
 def get_sgcard_not_admin(self):
     from relations.models import S_G_Card
     return S_G_Card.objects(group=self, is_active=True, is_admin=False)
开发者ID:longshenzhu,项目名称:COC,代码行数:5,代码来源:models.py

示例7: get_sgcard_inactive

# 需要导入模块: from relations.models import S_G_Card [as 别名]
# 或者: from relations.models.S_G_Card import objects [as 别名]
 def get_sgcard_inactive(self):
     from relations.models import S_G_Card
     return S_G_Card.objects(group=self, is_active=False)
开发者ID:longshenzhu,项目名称:COC,代码行数:5,代码来源:models.py

示例8: get_sgcard_all

# 需要导入模块: from relations.models import S_G_Card [as 别名]
# 或者: from relations.models.S_G_Card import objects [as 别名]
 def get_sgcard_all(self):
     from relations.models import S_G_Card
     return S_G_Card.objects(group=self)
开发者ID:longshenzhu,项目名称:COC,代码行数:5,代码来源:models.py

示例9: quitgroup

# 需要导入模块: from relations.models import S_G_Card [as 别名]
# 或者: from relations.models.S_G_Card import objects [as 别名]
 def quitgroup(self, user):
     from relations.models import S_G_Card
     S_G_Card.objects(user=user, group=self, is_active=True).update(set__is_active=False)
开发者ID:longshenzhu,项目名称:COC,代码行数:5,代码来源:models.py

示例10: ask_for_admin

# 需要导入模块: from relations.models import S_G_Card [as 别名]
# 或者: from relations.models.S_G_Card import objects [as 别名]
 def ask_for_admin(self,user):
     from relations.models import S_G_Card
     if not self.get_user_admin():
         S_G_Card.objects(user=user, group=self, is_active=True).update(set__is_admin=True)
开发者ID:longshenzhu,项目名称:COC,代码行数:6,代码来源:models.py

示例11: get_sgcard_admin

# 需要导入模块: from relations.models import S_G_Card [as 别名]
# 或者: from relations.models.S_G_Card import objects [as 别名]
 def get_sgcard_admin(self):
     from relations.models import S_G_Card
     return S_G_Card.objects(user=self, is_active=True, is_admin=True)
开发者ID:NCZkevin,项目名称:pyweb-test,代码行数:5,代码来源:models.py

示例12: find_group

# 需要导入模块: from relations.models import S_G_Card [as 别名]
# 或者: from relations.models.S_G_Card import objects [as 别名]
 def find_group(self):
     from relations.models import S_G_Card
     return S_G_Card.objects(group__nin=self.get_group_all())
开发者ID:NCZkevin,项目名称:pyweb-test,代码行数:5,代码来源:models.py

示例13: get_topic_group_active

# 需要导入模块: from relations.models import S_G_Card [as 别名]
# 或者: from relations.models.S_G_Card import objects [as 别名]
 def get_topic_group_active(self):#我关注的小组的话题
     from topic.models import Topic
     from relations.models import S_G_Card
     return Topic.objects(creator__in=S_G_Card.objects(group__in=self.get_group_active()), is_active=True)
开发者ID:NCZkevin,项目名称:pyweb-test,代码行数:6,代码来源:models.py


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