本文整理汇总了Python中pyvac.models.User.get_rtt_history方法的典型用法代码示例。如果您正苦于以下问题:Python User.get_rtt_history方法的具体用法?Python User.get_rtt_history怎么用?Python User.get_rtt_history使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类pyvac.models.User
的用法示例。
在下文中一共展示了User.get_rtt_history方法的1个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。
示例1: render
# 需要导入模块: from pyvac.models import User [as 别名]
# 或者: from pyvac.models.User import get_rtt_history [as 别名]
def render(self):
user = User.by_id(self.session,
int(self.request.matchdict['user_id']))
if self.user.has_no_role:
# can only see own requests
if user.id != self.user.id:
return HTTPFound(location=route_url('list_request',
self.request))
if self.user.is_manager:
# can only see own requests and managed user requests
if ((user.id != self.user.id)
and (user.manager_id != self.user.id)):
return HTTPFound(location=route_url('list_request',
self.request))
today = datetime.now()
year = int(self.request.params.get('year', today.year))
start = datetime(2014, 5, 1)
years = [item for item in reversed(range(start.year, today.year + 1))]
pool_history = User.get_rtt_history(self.session, user, year)
return {'user': user, 'year': year, 'years': years,
'pool_history': pool_history}