示例#1
0
文件: views.py 项目: St4nK/aurorai
def candm_events(request):
    """Renders the opex dashboard."""
    assert isinstance(request, HttpRequest)

    return render(
        request, 'v2/candm-travel.html', {
            'page': 'candm_travel',
            'user': request.user,
            'session': f.get_session_info(request)
        })
示例#2
0
文件: views.py 项目: St4nK/aurorai
def project_view(request):
    """Renders the home page."""
    template = 'v2/project_view.html'
    assert isinstance(request, HttpRequest)
    context = {
        'title': 'Home Page',
        'year': datetime.now().year,
        'user': request.user,
        'page': 'project_view',
        'session': f.get_session_info(request)
    }
    return render(request, template, context)
示例#3
0
文件: views.py 项目: St4nK/aurorai
def opex_candm_dashboard(request):
    """Renders the opex dashboard."""
    assert isinstance(request, HttpRequest)
    dataset = f.get_visi(1, ['package', 'month'])
    return render(
        request, 'v2/c_and_m_dashboard.html', {
            'data2': dataset,
            'title': 'Home Page',
            'year': datetime.now().year,
            'user': request.user,
            'page': 'opex_candm_dashboard',
            'session': f.get_session_info(request)
        })
示例#4
0
文件: views.py 项目: St4nK/aurorai
def opex_package_visi_dashboard(request, package):
    """Renders the opex dashboard."""
    assert isinstance(request, HttpRequest)
    #dataset = f.get_dataset("transactions", ['sub_package', 'vendor', 'gl'], {"package":package})
    package_list = f.get_value_list("transactions", "package")
    context = {
        'package_list': package_list,
        'package': package,
        'user': request.user,
        'page': 'opex_package_visi_dashboard',
        'session': f.get_session_info(request)
    }
    return render(request, 'v2/package_visi_dashboard.html', context)
示例#5
0
文件: views.py 项目: St4nK/aurorai
def opex_dashboard_v2(request):
    """Renders the opex dashboard."""
    assert isinstance(request, HttpRequest)
    dataset = f.get_dataset("transactions",
                            ['package', 'sub_package', 'vendor', 'gl'])
    return render(
        request, 'v2/opex_dashboard.html', {
            'data2': dataset,
            'title': 'Home Page',
            'year': datetime.now().year,
            'page': 'opex_dashboard_v2',
            'session': f.get_session_info(request)
        })
示例#6
0
def home_v2(request):
    """Renders the home page."""
    template = 'v2/index.html'
    assert isinstance(request, HttpRequest)
    project_list = f.get_projects_list(request)
    context = {
        'title': 'Home Page',
        'year': datetime.now().year,
        'project_list': project_list,
        'session': f.get_session_info(request),
        'user': request.user,
    }
    return render(request, template, context)
示例#7
0
def opex_visi_dashboard(request):
    """Renders the opex dashboard."""
    assert isinstance(request, HttpRequest)
    dataset = f.get_dataset("transactions",
                            ['package', 'sub_package', 'vendor', 'country'])
    return render(
        request, 'v2/visibility_dashboard2.html', {
            'data2': dataset,
            'title': 'Home Page',
            'year': datetime.now().year,
            'user': request.user,
            'page': 'opex_visi_dashboard',
            'session': f.get_session_info(request)
        })
示例#8
0
def edit_project_view(request):
    """Renders the home page."""
    template = 'v2/edit_project.html'
    assert isinstance(request, HttpRequest)
    assigned_users = f.get_assigned_users(request)
    assigned_users = json.dumps(assigned_users)
    unassigned_users = f.get_unassigned_users(request)
    unassigned_users = json.dumps(unassigned_users)
    if request.GET.get('selected') != None:
        new_user = request.GET.get('selected')
        new_user = User.objects.get(first_name=new_user)
        f.add_member(new_user, request)
        assigned_users = f.get_assigned_users(request)
        unassigned_users = f.get_unassigned_users(request)
        data = json.dumps({
            'assigned_users': assigned_users,
            'unassigned_users': unassigned_users
        })
        return HttpResponse(data, content_type='application/json')
    if request.GET.get('delete') != None:
        delete_user = request.GET.get('delete')
        delete_user = User.objects.get(first_name=delete_user)
        f.remove_member(delete_user, request)
        assigned_users = f.get_assigned_users(request)
        unassigned_users = f.get_unassigned_users(request)
        data = json.dumps({
            'assigned_users': assigned_users,
            'unassigned_users': unassigned_users
        })
        return HttpResponse(data, content_type='application/json')
    context = {
        'title': 'Edit Project',
        'year': datetime.now().year,
        'user': request.user,
        'page': 'edit_project',
        'assigned_users': assigned_users,
        'unassigned_users': unassigned_users,
        'session': f.get_session_info(request)
    }
    return render(request, template, context)