def doActivity(context, request): context['checkitems'] = getFields(request, context) forminput = getFields(request, context) if 'items' in context: del context['items'] context['action'] = 'enumerate' # import datelist # daterange = datelist.datelist # getitems(table, num2ret, start_date, end_date, period) # print getitems('collectionobjects', 100, '1999-01-01', '2015-05-01', 'month') num2ret = 500 period = forminput['period'][2] table = forminput['activity'][2] start = forminput['date.start'][2] end = forminput['date.end'][2] context['num2ret'] = num2ret context['period'] = period context['activity'] = table context['start'] = start context['end'] = end daterange = activity2db.getitems(table, num2ret, start, end, period) rows = [] for d in daterange: row = {} for i,field in enumerate('count date'.split(' ')): row[field] = d[i] rows.append(row) data = rows class NameTable(tables.Table): count = tables.Column(verbose_name='count') date = tables.Column(verbose_name='date') table = NameTable(data) context['reviewitems'] = table context['numberofitems'] = len(data) context['action'] = 'end' return context
def doActivity(context, request): context['checkitems'] = getFields(request, context) forminput = getFields(request, context) if 'items' in context: del context['items'] context['action'] = 'enumerate' # import datelist # daterange = datelist.datelist # getitems(table, num2ret, start_date, end_date, period) # print(getitems('collectionobjects', 100, '1999-01-01', '2015-05-01', 'month')) num2ret = 500 period = forminput['period'][2] table = forminput['activity'][2] start = forminput['date.start'][2] end = forminput['date.end'][2] context['num2ret'] = num2ret context['period'] = period context['activity'] = table context['start'] = start context['end'] = end daterange = activity2db.getitems(table, num2ret, start, end, period) rows = [] for d in daterange: row = {} for i, field in enumerate('count date'.split(' ')): row[field] = d[i] rows.append(row) data = rows class NameTable(tables.Table): count = tables.Column(verbose_name='count') date = tables.Column(verbose_name='date') table = NameTable(data) context['reviewitems'] = table context['numberofitems'] = len(data) context['action'] = 'end' return context
def getData(context,request): context ={} for formField in request.GET: context[formField] = request.GET[formField] # import datelist # print getitems('collectionobjects', 100, '1999-01-01', '2015-05-01', 'month') # data = datelist.datelist num2ret = context['num2ret'] period = context['period'] table = context['activity'] start = context['start'] end = context['end'] data = activity2db.getitems(table, num2ret, start, end, period) context['data'] = data context['numberofitems'] = len(data) return context
def getData(context, request): context = {} for formField in request.GET: context[formField] = request.GET[formField] # import datelist # print(getitems('collectionobjects', 100, '1999-01-01', '2015-05-01', 'month')) # data = datelist.datelist num2ret = context['num2ret'] period = context['period'] table = context['activity'] start = context['start'] end = context['end'] data = activity2db.getitems(table, num2ret, start, end, period) context['data'] = data context['numberofitems'] = len(data) return context