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

Python meta.Session类代码示例

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

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



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

示例1: find_by_id

    def find_by_id(cls, id, abort_404 = True, published = True):
        if published:
            result = Session.query(Schedule).filter_by(id=id).filter_by(published=published).first()
        else:
            result = Session.query(Schedule).filter_by(id=id).first()

        if result is None and abort_404:
            abort(404, "No such Schedule")
        return result
开发者ID:CarlFK,项目名称:zookeepr,代码行数:9,代码来源:schedule.py


示例2: find_by_id

    def find_by_id(cls, id, abort_404 = True, published = True):
        if published:
            #I can't see why this exists as events as published, not schedules
            #Original: result = Session.query(Schedule).filter_by(id=id).filter_by(published=published).first()
            result = Session.query(Schedule).filter_by(id=id).first()
        else:
            result = Session.query(Schedule).filter_by(id=id).first()

        if result is None and abort_404:
            abort(404, "No such Schedule")
        return result
开发者ID:faline-eyes,项目名称:zookeepr,代码行数:11,代码来源:schedule.py


示例3: find_next_proposal

 def find_next_proposal(cls, id, type_id, signed_in_person_id):
     withdrawn = FundingStatus.find_by_name('Withdrawn')
     next = Session.query(Funding).from_statement("""
           SELECT
               f.id
           FROM
               (SELECT id
                FROM funding
                WHERE id <> %d
                  AND status_id <> %d
                  AND funding_type_id = %d
                EXCEPT
                    SELECT funding_id AS id
                    FROM funding_review
                    WHERE funding_review.reviewer_id = %d) AS f
           LEFT JOIN
                   funding_review AS r
                           ON(f.id=r.funding_id)
           GROUP BY
                   f.id
           ORDER BY COUNT(r.reviewer_id), RANDOM()
           LIMIT 1
     """ % (id, withdrawn.id, type_id, signed_in_person_id))
     next = next.first()
     if next is not None:
         return next.id
     else:
         # looks like you've reviewed everything!
         return None
开发者ID:CarlFK,项目名称:zookeepr,代码行数:29,代码来源:funding.py


示例4: find_accepted_by_id

    def find_accepted_by_id(cls, id):
        #status = ProposalStatus.find_by_name('Accepted')
        #result = Session.query(Proposal).filter_by(id=id,status_id=status.id)

        # Optimisation: assume that ProposalStatus of ID=1 is Accepted
        result = Session.query(Proposal).filter_by(id=id,status_id=1).one()
        return result
开发者ID:CarlFK,项目名称:zookeepr,代码行数:7,代码来源:proposal.py


示例5: select_values

 def select_values(self):
     streams = Session.query(Stream).order_by(Stream.name).all()
     values = [ (None, '(none)') ]
     for stream in streams:
         v = (stream.id, stream.name)
         values.append(v)
     return values
开发者ID:CarlFK,项目名称:zookeepr,代码行数:7,代码来源:stream.py


示例6: find_scheduled_by_date_and_type

    def find_scheduled_by_date_and_type(cls, date, event_type):
        from zookeepr.model.schedule import Schedule
        from zookeepr.model.event import Event
        from zookeepr.model.time_slot import TimeSlot

        start   = datetime.combine(date,time(0,0,0))
        end     = datetime.combine(date,time(23,59,59))
        return Session.query(Location).join(Schedule).join(Event).join(TimeSlot).filter(Event.type==event_type).filter(TimeSlot.start_time.between(start, end)).order_by(Location.display_order).all()
开发者ID:CarlFK,项目名称:zookeepr,代码行数:8,代码来源:location.py


示例7: find_by_date

    def find_by_date(cls, date, primary=False):
        start = datetime.combine(date, time(0, 0, 0))
        end = datetime.combine(date, time(23, 59, 59))

        if primary == True:
            return (
                Session.query(TimeSlot)
                .filter(TimeSlot.start_time.between(start, end))
                .filter(TimeSlot.primary == primary)
                .order_by(TimeSlot.start_time)
                .all()
            )
        else:
            return (
                Session.query(TimeSlot)
                .filter(TimeSlot.start_time.between(start, end))
                .order_by(TimeSlot.start_time)
                .all()
            )
开发者ID:timClicks,项目名称:zookeepr,代码行数:19,代码来源:time_slot.py


示例8: find_all_by_funding_type_id

    def find_all_by_funding_type_id(cls, id, abort_404 = True, include_withdrawn=True):
        result = Session.query(Funding).filter_by(funding_type_id=id)
        if not include_withdrawn:
            withdrawn = FundingStatus.find_by_name('Withdrawn')
            result = result.filter(Funding.status_id != withdrawn.id)

        result = result.all()
        if result is None and abort_404:
            abort(404, "No such funding object")
        return result
开发者ID:CarlFK,项目名称:zookeepr,代码行数:10,代码来源:funding.py


示例9: find_all_by_proposal_type_id

    def find_all_by_proposal_type_id(cls, id, abort_404 = True, include_withdrawn=True):
        result = Session.query(Proposal).filter_by(proposal_type_id=id)
        if not include_withdrawn:
            withdrawn = ProposalStatus.find_by_name('Withdrawn')
            result = result.filter(Proposal.status_id != withdrawn.id)

        result = result.all()
        if result is None and abort_404:
            abort(404, "No such proposal object")
        return result
开发者ID:CarlFK,项目名称:zookeepr,代码行数:10,代码来源:proposal.py


示例10: find_by_id

 def find_by_id(cls, id, abort_404 = True):
     result = Session.query(RegoRoom).filter_by(id=id).first()
     if result is None and abort_404:
         abort(404, "No such rego room object")
     return result
开发者ID:faline-eyes,项目名称:zookeepr,代码行数:5,代码来源:rego_room.py


示例11: find_by_code

 def find_by_code(cls, code):
     return Session.query(Voucher).filter_by(code=code).first()
开发者ID:CarlFK,项目名称:zookeepr,代码行数:2,代码来源:voucher.py


示例12: find_all

 def find_all(cls):
     return Session.query(Voucher).order_by(Voucher.id).all()
开发者ID:CarlFK,项目名称:zookeepr,代码行数:2,代码来源:voucher.py


示例13: find_by_id

 def find_by_id(cls, id):
     return Session.query(Ceiling).filter_by(id=id).first()
开发者ID:CarlFK,项目名称:zookeepr,代码行数:2,代码来源:ceiling.py


示例14: find_by_category

 def find_by_category(cls, id):
     return Session.query(Product).filter_by(category_id=id)
开发者ID:CarlFK,项目名称:zookeepr,代码行数:2,代码来源:product.py


示例15: find_all

 def find_all(self):
     return Session.query(Product).order_by(Product.cost).all()
开发者ID:CarlFK,项目名称:zookeepr,代码行数:2,代码来源:product.py


示例16: find_by_id

 def find_by_id(cls, id):
     return Session.query(SpecialOffer).filter_by(id=id).first()
开发者ID:CarlFK,项目名称:zookeepr,代码行数:2,代码来源:special_offer.py


示例17: find_by_name

 def find_by_name(cls, name):
     return Session.query(SpecialOffer).filter_by(name=name).first()
开发者ID:CarlFK,项目名称:zookeepr,代码行数:2,代码来源:special_offer.py


示例18: find_by_event

 def find_by_event(cls,id):
     result = Session.query(Vote).filter_by(event_id=id)
     return result
开发者ID:mikalstill,项目名称:zookeepr,代码行数:3,代码来源:vote.py


示例19: find_by_id

 def find_by_id(cls, id):
     return Session.query(Product).filter_by(id=id).first()
开发者ID:CarlFK,项目名称:zookeepr,代码行数:2,代码来源:product.py


示例20: find_by_rego

 def find_by_rego(cls,id):
     result = Session.query(Vote).filter_by(rego_id=id)
     return result
开发者ID:mikalstill,项目名称:zookeepr,代码行数:3,代码来源:vote.py



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


鲜花

握手

雷人

路过

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

请发表评论

全部评论

专题导读
上一篇:
Python zoominterface.Zoomable类代码示例发布时间:2022-05-26
下一篇:
Python helpers.flash函数代码示例发布时间: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