示例#1
0
def plot_useranalytics(request):

    userid = request.GET.get('userid', -1)
    start_date = request.GET.get('start')
    end_date = request.GET.get('end')

    print userid, start_date, end_date

    if request.user.is_superuser:
        end = _parse_date(end_date) if end_date else datetime.now()
        start = _parse_date(start_date) if start_date else end - timedelta(end.isoweekday() + 7)
        f = generateReport( userid, 10, start, end )
    else:
        f = figure(1, figsize=(6,6))

    canvas = FigureCanvasAgg( f )
    response = HttpResponse(content_type='image/png')
    canvas.print_png(response)
    return response
示例#2
0
def plot_useranalytics(request):
    """ Creates a PNG image containing different plots for analzing the
    performance of individual users over time.
    """
    userid = request.GET.get('userid', -1)
    start_date = request.GET.get('start')
    end_date = request.GET.get('end')

    print userid, start_date, end_date

    if request.user.is_superuser:
        end = _parse_date(end_date) if end_date else datetime.now()
        start = _parse_date(start_date) if start_date else end - timedelta(end.isoweekday() + 7)
        f = generateReport( userid, 10, start, end )
    else:
        f = figure(1, figsize=(6,6))

    canvas = FigureCanvasAgg( f )
    response = HttpResponse(content_type='image/png')
    canvas.print_png(response)
    return response
示例#3
0
def plot_useranalytics(request):
    """ Creates a PNG image containing different plots for analzing the
    performance of individual users over time.
    """
    userid = request.GET.get('userid', -1)
    start_date = request.GET.get('start')
    end_date = request.GET.get('end')

    print userid, start_date, end_date

    if request.user.is_superuser:
        end = _parse_date(end_date) if end_date else datetime.now()
        start = _parse_date(start_date) if start_date else end - timedelta(
            end.isoweekday() + 7)
        f = generateReport(userid, 10, start, end)
    else:
        f = figure(1, figsize=(6, 6))

    canvas = FigureCanvasAgg(f)
    response = HttpResponse(content_type='image/png')
    canvas.print_png(response)
    return response