本文整理汇总了Python中pyvac.models.Request.get_by_month方法的典型用法代码示例。如果您正苦于以下问题:Python Request.get_by_month方法的具体用法?Python Request.get_by_month怎么用?Python Request.get_by_month使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类pyvac.models.Request
的用法示例。
在下文中一共展示了Request.get_by_month方法的4个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。
示例1: test_get_by_month
# 需要导入模块: from pyvac.models import Request [as 别名]
# 或者: from pyvac.models.Request import get_by_month [as 别名]
def test_get_by_month(self):
from pyvac.models import Request
month = 8
year = 2011
country = u'fr'
requests = Request.get_by_month(self.session, country, month, year)
self.assertEqual(len(requests), 1)
示例2: render
# 需要导入模块: from pyvac.models import Request [as 别名]
# 或者: from pyvac.models.Request import get_by_month [as 别名]
def render(self):
exported = {}
if self.user.is_admin:
requests = Request.get_by_month(self.session)
data = []
header = '%s,%s,%s,%s,%s,%s' % ('#', 'user', 'from', 'to', 'number', 'type')
data.append(header)
for idx, req in enumerate(requests, start=1):
data.append('%d,%s' % (idx, req.summarycsv))
exported = '\n'.join(data)
return {u'exported': exported}
示例3: render
# 需要导入模块: from pyvac.models import Request [as 别名]
# 或者: from pyvac.models.Request import get_by_month [as 别名]
def render(self):
exported = {}
if self.user.is_admin:
country = self.user.country
month, year = self.request.params.get('month').split('/')
requests = Request.get_by_month(self.session, country,
int(month), int(year))
data = []
header = '%s,%s,%s,%s,%s,%s,%s' % ('#', 'lastname', 'firstname',
'from', 'to', 'number', 'type')
data.append(header)
for idx, req in enumerate(requests, start=1):
data.append('%d,%s' % (idx, req.summarycsv))
exported = '\n'.join(data)
return {u'exported': exported}
示例4: test_get_by_month
# 需要导入模块: from pyvac.models import Request [as 别名]
# 或者: from pyvac.models.Request import get_by_month [as 别名]
def test_get_by_month(self):
from pyvac.models import Request
month = 3
requests = Request.get_by_month(self.session, month)
self.assertEqual(len(requests), 2)