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

Python tools.getResult函数代码示例

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

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



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

示例1: getTicketByUserRule

def getTicketByUserRule(request):
    ruleid = request.REQUEST.get('ruleid','')
    if not ruleid:
        return getResult(True,'',[])
    kindlist = []
    kindidlist = set()
    kinddict = {}
    tids = set()
    for r in Relation.objects.filter(rule=ruleid).order_by('id'):
        tids.add(r.ticket_id)
    for ticket in Ticket.objects.filter(id__in=tids).order_by('id'):
        ticketFather(ticket, kinddict, kindidlist)
    for kid in kindidlist:
        kind = kinddict.get(str(kid))
        if not kind['fatherid']:
            kindlist.append(kind)
        else:
            kinddict[str(kind.get('fatherid'))]['children'].append(kind)
    for kind in kinddict.values():
        if len(kind['children']) == 0:
            del kind['children']
    l=[]
    for k in kinddict.values():
        if not hasattr(k,'children'):
            l.append(k)
    return getResult(True, '', {"kindlist":kindlist,"kindalllist":l})
开发者ID:wangjian2254,项目名称:FTknowledge,代码行数:26,代码来源:newviews.py


示例2: getHistory

def getHistory(request):
    content_type_id = request.REQUEST.get('object_type', None)
    object_id = request.REQUEST.get('object_id',None)
    uid = request.REQUEST.get('uid', None)
    logquery = LogEntry.objects.all().order_by('-id')

    start = request.REQUEST.get('start', None)
    end = request.REQUEST.get('end', None)
    if start and end:
        with c:
            startdate = datetime.datetime.strptime(start, "%Y/%m/%d")
            enddate = datetime.datetime.strptime(end, "%Y/%m/%d") + datetime.timedelta(days=1)
        logquery = logquery.filter(action_time__lt=enddate, action_time__gte=startdate)
    elif content_type_id and object_id:
        logquery = logquery.filter(object_id=object_id)
    else:
        return getResult(False,u'请提供查询范围')

    if content_type_id:
        logquery=logquery.filter(content_type=content_type_id)
    if object_id:
        logquery = logquery.filter(object_id=object_id)
    if uid:
        logquery = logquery.filter(user=uid)
    l = []
    for log in logquery:
        l.append(log2dict(log))
    return getResult(True,u'获取到日志',l)
开发者ID:wangjian2254,项目名称:FTknowledge,代码行数:28,代码来源:view_history.py


示例3: getPZ

def getPZ(request):
    subjectid = request.REQUEST.get('subjectid','')
    subject = Subject.objects.get(pk=subjectid)
    pz = PZ.objects.filter(subject=subject)[:1]
    result = {'fllist':[],'pzdesc':'',"kindid":subject.kmkind_id}
    if len(pz)>0:
        pz = pz[0]
        fllist=[]
        for fl in FL.objects.filter(pz=pz).order_by('id'):
            f={'kjkm':fl.kmmc_id, 'fx':fl.fx, 'id':fl.pk, 'zy':fl.zy}
            if fl.fx:
                f['jje'] = str(fl.num)
                if not fl.num:
                    f['jje']=0
            else:
                f['dje'] = str(fl.num)
                if not fl.num:
                    f['dje']=0
            fllist.append(f)
        result['fllist']=fllist
        result['pzdesc']= pz.desc
        result['pzid']=pz.pk
        # result['imgurl']= pz.getImg()
        return getResult(True,'',result)
    else:
        return getResult(True,'',result)
开发者ID:wangjian2254,项目名称:FTknowledge,代码行数:26,代码来源:view_subject.py


示例4: saveUser

def saveUser(request):
    id = request.REQUEST.get('id', '')
    if id:
        user = User.objects.get(pk=id)
    else:
        user = User()
        user.set_password('111111')
        user.username = request.REQUEST.get('username', '')
        if not user.username or User.objects.filter(username=user.username).count() > 0:
            return getResult(False, u'用户名已经存在', None)
    is_active = request.REQUEST.get('isaction', '')
    if is_active:
        if is_active == 'true':
            user.is_active = True
        else:
            user.is_active = False
    is_staff = request.REQUEST.get('ismanager', '')
    if is_staff:
        if is_staff == 'true':
            user.is_staff = True
        else:
            user.is_staff = False
    user.first_name = request.REQUEST.get('truename', u'游客')
    if request.REQUEST.has_key('password'):
        user.set_password(request.REQUEST.get('password'))
    user.save()
    return getResult(True, '', {'username': user.username, 'truename': user.first_name, 'ismanager': user.is_staff,
                                'isaction': user.is_active, 'id': user.pk})
开发者ID:wangjian2254,项目名称:FTknowledge,代码行数:28,代码来源:views.py


示例5: updateKJKMKind

def updateKJKMKind(request):
    pk = request.REQUEST.get('id', '')
    if pk:
        kindForm = KMKindForm(request.POST, instance=KMKind.objects.get(pk=pk))
    else:
        kindForm = KMKindForm(request.POST)

    if not kindForm.is_valid():
        msg = kindForm.json_error()
        return getResult(False, msg, None)
    kind = kindForm.save()
    # l=[]
    if not pk:
        k = json.load(open("%skjkm.json"%STATIC_ROOT))
        for oldkm in k:
            try:
                # l.append({'kmbh':km.name.split(":")[0],'name':km.name.split(":")[1]})
                km = KM()
                km.kind = kind
                km.kmbh = oldkm.get("kmbh", "")
                km.name = oldkm.get("name", "")
                km.save()
            except:
                pass
    return getResult(True, u'保存会计科目信息成功', kind.pk)
开发者ID:wangjian2254,项目名称:FTknowledge,代码行数:25,代码来源:view_kjkm.py


示例6: delKJKM

def delKJKM(request):
    pk = request.REQUEST.get('id', '')
    kind = KM.objects.get(pk=pk)
    if 0==kind.fl_set.count():
        kind.fl_set.all().delete()
        kind.delete()
        return getResult(True, u'会计科目删除成功',None)
    return getResult(False, u'会计科目删除失败,还有题目使用此会计科目', None)
开发者ID:wangjian2254,项目名称:FTknowledge,代码行数:8,代码来源:view_kjkm.py


示例7: delOption

def delOption(request):
    id = request.REQUEST.get('id', '')
    if id:
        kind = Option.objects.get(pk=id)
        kind.delete()
    else:
        getResult(False, u'选项不存在', None)

    return getResult(True, u'选项删除成功', id)
开发者ID:wangjian2254,项目名称:FTknowledge,代码行数:9,代码来源:view_subject.py


示例8: delKjkmKind

def delKjkmKind(request):
    pk = request.REQUEST.get('id', '')
    kind = KMKind.objects.get(pk=pk)
    if 0==kind.subject_set.count():
        kind.subject_set.all().delete()
        kind.km_set.all().delete()
        kind.delete()
        return getResult(True, u'会计科目分类删除成功',None)
    return getResult(False, u'会计科目分类删除失败,还有题目使用此会计科目', None)
开发者ID:wangjian2254,项目名称:FTknowledge,代码行数:9,代码来源:view_kjkm.py


示例9: delRule

def delRule(request):
    id = request.REQUEST.get('id', '')
    if id:
        rule = Rule.objects.get(pk=id)
        rule.delete()
    else:
        getResult(False, u'行业不存在', None)

    return getResult(True, '', None)
开发者ID:wangjian2254,项目名称:FTknowledge,代码行数:9,代码来源:newviews.py


示例10: getSubjectByPaper

def getSubjectByPaper(request):
    pid = request.REQUEST.get('pid')
    if pid:
        paper = Paper.objects.get(pk=pid)
        subjects = MyEncoder.default(paper.subjects.order_by('papersubject'))

        return getResult(True, u'获取到试题成功', subjects)
    else:
        return getResult(False, u'获取试题失败,请提供试卷id', None)
开发者ID:wangjian2254,项目名称:FTknowledge,代码行数:9,代码来源:view_shijuan.py


示例11: regUser

def regUser(request):
    result = saveUser(request)
    if result.get('success'):
        auth_login(request, User.objects.get(pk=result.get('result').get('pk')))

        if request.session.test_cookie_worked():
            request.session.delete_test_cookie()
        return getResult(True, '', None)
    else:
        return getResult(False, '注册失败', None)
开发者ID:wangjian2254,项目名称:FTknowledge,代码行数:10,代码来源:views.py


示例12: delTicket

def delTicket(request):
    id = request.REQUEST.get('id', '')
    if id:
        taxTicket = Ticket.objects.get(pk=id)
        cache.delete('allticket')
        taxTicket.delete()
    else:
        getResult(False, u'票据不存在', None)

    return getResult(True, '', None)
开发者ID:wangjian2254,项目名称:FTknowledge,代码行数:10,代码来源:newviews.py


示例13: getSubjectByKind

def getSubjectByKind(request):
    kind = request.REQUEST.get('kind', None)
    if kind:
        sl = []
        query = Subject.objects.filter(Q(title__icontains=kind)|Q(flag__icontains=kind)).order_by('title')
        for subject in query:
            sl.append(MyEncoder.default(subject))
        return getResult(True, '', {'result': sl, 'limit': query.count(), 'start': 0, 'total': query.count()})
    else:
        return getResult(False, u'请提供关键字', None)
开发者ID:wangjian2254,项目名称:FTknowledge,代码行数:10,代码来源:view_subject.py


示例14: getGuan

def getGuan(request):
    '''
    根据 id 获取一张关卡的完整信息,包括试卷
    '''
    id = request.REQUEST.get('id', '')
    if id:
        guan = Guan.objects.get(pk=id)
        pdict = MyEncoder.default(guan)
        return getResult(True, u'获取关卡成功', pdict)
    else:
        return getResult(False, u'关卡不存在', id)
开发者ID:wangjian2254,项目名称:FTknowledge,代码行数:11,代码来源:view_guan.py


示例15: getPaperByKind

def getPaperByKind(request):
    kind = request.REQUEST.get('kind', None)
    if kind:
        paperlist = []
        query = Paper.objects.filter(Q(title__icontains=kind) | Q(flag__icontains=kind)).order_by('title')
        for p in query:
            paperlist.append({"id": p.pk, 'title': p.title, 'kmkind': p.kmkind_id, 'flag': p.flag, 'content': p.content,
                              'right_ztdm': p.right_ztdm, 'is_pub': p.is_pub, 'guan_id': p.guan_id, 'time': p.time})
        return getResult(True, '', {'result': paperlist, 'limit': query.count(), 'start': 0, 'total': query.count()})
    else:
        return getResult(False, u'请提供关键字', None)
开发者ID:wangjian2254,项目名称:FTknowledge,代码行数:11,代码来源:view_shijuan.py


示例16: delImg

def delImg(request):
    imgurl = request.REQUEST.get('imgurl','')
    if imgurl:
        if ImageInfo.objects.filter(img__iendswith = imgurl.split('/')[-1]).count()==0:
            return getResult(True,'')
        else:
            for img in  ImageInfo.objects.filter(img__iendswith = imgurl.split('/')[-1]):
                cache.delete('all%s'%img.modelType)
                img.img.delete()
                img.delete()
            return getResult(True,'')
    return getResult(False,'')
开发者ID:wangjian2254,项目名称:FTknowledge,代码行数:12,代码来源:imgviews.py


示例17: getPaperByGuan

def getPaperByGuan(request):
    '''
    获取关卡下的所有试卷
    '''
    pid = request.REQUEST.get('pid')
    if pid:
        guan = Guan.objects.get(pk=pid)
        subjects = MyEncoder.default(guan.paper_set.all())

        return getResult(True, u'获取到关卡成功', subjects)
    else:
        return getResult(False, u'获取关卡失败,请提供关卡id', None)
开发者ID:wangjian2254,项目名称:FTknowledge,代码行数:12,代码来源:view_guan.py


示例18: deleteRule

def deleteRule(request):
    ruleid = request.REQUEST.get('ruleid')
    rule = TaxRule.objects.get(pk=ruleid)
    try:
        if not rule.subject_set.exists():
            rule.delete()
            return getResult(True, u'删除成功', None)
        else:
            raise 'error'

    except Exception, e:
        return getResult(False, u'规则被使用,无法删除', None)
开发者ID:wangjian2254,项目名称:FTknowledge,代码行数:12,代码来源:views.py


示例19: saveTuZhang

def saveTuZhang(request):
    name = request.REQUEST.get('name', '')
    id = request.REQUEST.get('id', '')
    if id:
        rule = TaxTuZhang.objects.get(pk=id)
    else:
        if TaxTuZhang.objects.filter(name=name).count() > 0:
            return getResult(False, u'图章模板名称不能重复', None)
        rule = TaxTuZhang()
    rule.name = name
    rule.save()
    return getResult(True, u'保存图章模板成功', {'id': rule.pk, 'name': rule.name})
开发者ID:wangjian2254,项目名称:FTknowledge,代码行数:12,代码来源:views.py


示例20: getSubjectById

def getSubjectById(request):
    id = request.REQUEST.get('id', '')
    if id:
        kind = Subject.objects.get(pk=id)
        k=MyEncoder.default(kind)
        k ['options']= []
        for o in Option.objects.filter(subject=kind):
            k['options'].append(MyEncoder.default(o))

        return getResult(True, u'获取考题成功', k)
    else:
        return getResult(False, u'考题不存在', None)
开发者ID:wangjian2254,项目名称:FTknowledge,代码行数:12,代码来源:view_subject.py



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


鲜花

握手

雷人

路过

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

请发表评论

全部评论

专题导读
上一篇:
Python torTools.getConn函数代码示例发布时间:2022-05-26
下一篇:
Python timesince.timesince函数代码示例发布时间:2022-05-26
热门推荐
阅读排行榜

扫描微信二维码

查看手机版网站

随时了解更新最新资讯

139-2527-9053

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

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

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