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


Python Request.all_for_admin方法代码示例

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


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

示例1: test_all_for_admin

# 需要导入模块: from pyvac.models import Request [as 别名]
# 或者: from pyvac.models.Request import all_for_admin [as 别名]
 def test_all_for_admin(self):
     from pyvac.models import Request
     with freeze_time('2014-12-25',
                      ignore=['celery', 'psycopg2', 'sqlalchemy',
                              'icalendar']):
         nb_requests = Request.all_for_admin(self.session, count=True)
     self.assertEqual(nb_requests, 19)
开发者ID:doyousoft,项目名称:pyvac,代码行数:9,代码来源:test_models.py

示例2: render

# 需要导入模块: from pyvac.models import Request [as 别名]
# 或者: from pyvac.models.Request import all_for_admin [as 别名]
    def render(self):

        req_list = {'requests': [], 'conflicts': {}}
        requests = []
        if self.user.is_admin:
            requests = Request.all_for_admin(self.session)
        elif self.user.is_super:
            requests = Request.by_manager(self.session, self.user)

        if requests:
            conflicts = {}
            for req in requests:
                req.conflict = [req2.summary for req2 in
                                Request.in_conflict(self.session, req)]
                if req.conflict:
                    conflicts[req.id] = '\n'.join(req.conflict)
            req_list['requests'] = requests
            req_list['conflicts'] = conflicts

        # always add our requests
        for req in Request.by_user(self.session, self.user):
            if req not in req_list['requests']:
                req_list['requests'].append(req)

        return req_list
开发者ID:grigouze,项目名称:pyvac,代码行数:27,代码来源:request.py

示例3: test_all_for_admin

# 需要导入模块: from pyvac.models import Request [as 别名]
# 或者: from pyvac.models.Request import all_for_admin [as 别名]
    def test_all_for_admin(self):
        from pyvac.models import Request

        nb_requests = Request.all_for_admin(self.session, count=True)
        self.assertEqual(nb_requests, 14)
开发者ID:baloo,项目名称:pyvac,代码行数:7,代码来源:test_models.py


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