def calendar_day_view(request, year, month,day): # TODO make sure to constrain based upon permissions # TODO find all date_field accessible reports year,month,day=int(year),int(month),int(day) reports=[r[1] for r in reportengine.all_reports() if r[1].date_field] date=datetime.datetime(year=year,month=month,day=day) cal=calendar.monthcalendar(year,month) # TODO possibly pull in date based aggregates? cx={"reports":reports,"date":date,"calendar":cal} return render_to_response("reportengine/calendar_day.html",cx, context_instance=RequestContext(request))
def calendar_day_view(request, year, month, day): # TODO make sure to constrain based upon permissions # TODO find all date_field accessible reports year, month, day = int(year), int(month), int(day) reports = [r[1] for r in reportengine.all_reports() if r[1].date_field] date = datetime.datetime(year=year, month=month, day=day) cal = calendar.monthcalendar(year, month) # TODO possibly pull in date based aggregates? cx = {"reports": reports, "date": date, "calendar": cal} return render_to_response("reportengine/calendar_day.html", cx, context_instance=RequestContext(request))
def calendar_month_view(request, year, month): # TODO make sure to constrain based upon permissions # TODO find all date_field accessible reports year,month=int(year),int(month) reports=[r[1] for r in reportengine.all_reports() if r[1].date_field] date=datetime.datetime(year=year,month=month,day=1) prev_month=date-datetime.timedelta(days=1) nxt_month=next_month(date) cal=calendar.monthcalendar(year,month) # TODO possibly pull in date based aggregates? cx={"reports":reports,"date":date,"calendar":cal,"prev":prev_month,"next":nxt_month} return render_to_response("reportengine/calendar_month.html",cx, context_instance=RequestContext(request))
def test_report_register(self): """ Tests registering a report, and verifies report is now accessible """ r = BasicTestReport() reportengine.register(r) assert (reportengine.get_report("testing", "test") == r) found = False for rep in reportengine.all_reports(): if rep[0] == (r.namespace, r.slug): assert (rep[1] == r) found = True assert (found)
def test_report_register(self): """ Tests registering a report, and verifies report is now accessible """ r=BasicTestReport() reportengine.register(r) assert(reportengine.get_report("testing","test") == r) found=False for rep in reportengine.all_reports(): if rep[0] == (r.namespace,r.slug): assert(rep[1] == r) found=True assert(found)
def calendar_month_view(request, year, month): # TODO make sure to constrain based upon permissions # TODO find all date_field accessible reports year, month = int(year), int(month) reports = [r[1] for r in reportengine.all_reports() if r[1].date_field] date = datetime.datetime(year=year, month=month, day=1) prev_month = date - datetime.timedelta(days=1) nxt_month = next_month(date) cal = calendar.monthcalendar(year, month) # TODO possibly pull in date based aggregates? cx = { "reports": reports, "date": date, "calendar": cal, "prev": prev_month, "next": nxt_month } return render_to_response("reportengine/calendar_month.html", cx, context_instance=RequestContext(request))
def report_list(request): # TODO make sure to constrain based upon permissions reports = [{'namespace': r.namespace, 'slug': r.slug, 'verbose_name': r.verbose_name} \ for s, r in reportengine.all_reports()] return render_to_response('reportengine/list.html', {'reports': reports}, context_instance=RequestContext(request))
def report_list(request): # TODO make sure to constrain based upon permissions r = reportengine.all_reports() return render_to_response('reportengine/list.html', {'reports': r}, context_instance=RequestContext(request))