本文整理汇总了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)
示例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
示例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)