本文整理汇总了Python中pyvac.models.Request.by_user_future_pending方法的典型用法代码示例。如果您正苦于以下问题:Python Request.by_user_future_pending方法的具体用法?Python Request.by_user_future_pending怎么用?Python Request.by_user_future_pending使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类pyvac.models.Request
的用法示例。
在下文中一共展示了Request.by_user_future_pending方法的1个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。
示例1: render
# 需要导入模块: from pyvac.models import Request [as 别名]
# 或者: from pyvac.models.Request import by_user_future_pending [as 别名]
def render(self):
if not self.user:
return self.redirect()
_ = self.request.translate
self.user.rtt = self.user.get_rtt_usage(self.session)
holidays = get_holiday(self.user)
ret_dict = {'types': [], 'holidays': holidays, 'sudo_users': [],
'futures_pending': [], 'futures_approved': []}
vacation_types = VacationType.by_country(self.session,
self.user.country)
for vac in vacation_types:
if vac.visibility and self.user.role not in vac.visibility:
continue
ret_dict['types'].append({'name': _(vac.name), 'id': vac.id})
if self.user.is_admin:
ret_dict['sudo_users'] = User.for_admin(self.session, self.user)
futures_pending = [timestamp
for req in
Request.by_user_future_pending(self.session,
self.user)
for timestamp in req.timestamps]
ret_dict['futures_pending'] = futures_pending
futures_approved = [timestamp
for req in
Request.by_user_future_approved(self.session,
self.user)
for timestamp in req.timestamps]
ret_dict['futures_approved'] = futures_approved
exception_info_tooltip = """\
This type is for events which are not covered by other types: \
wedding, funeral, etc.
Providing a reason for this request is mandatory.
"""
ret_dict['exception_info_tooltip'] = _(exception_info_tooltip)
if self.request.matched_route:
matched_route = self.request.matched_route.name
ret_dict.update({
'matched_route': matched_route,
'csrf_token': self.request.session.get_csrf_token()})
return ret_dict
ret_dict.update({'csrf_token': self.request.session.get_csrf_token()})
return ret_dict