Пример #1
0
def my_vms_view(request):
    is_administer = is_admin(request.user)
    vm_list = VM.objects.filter(user=request.user).exclude(state='deleted')
    vms = list()
    for vm in vm_list:
        vms.append(vm.vm_info())
    return render_to_response('myVMs.html', locals())
Пример #2
0
def apply_new_vm(request):
    if request.POST.get('vm_type', '') and request.POST.get('os', '') and request.POST.get('memory', ''):
        os = request.POST.get('os', '')
        memory = int(request.POST.get('memory', ''))
        vm_type = request.POST.get('vm_type', '')
        reason = request.POST.get('reason', '')
        application = CreateApplication(applicant=request.user, vm_type=vm_type, os=os, memory=memory, reason=reason,
                                        state='pending')
        is_administer = is_admin(request.user)
        has_applied = 1
        application.save()
        return render_to_response('apply.html', locals())
    else:
        return HttpResponseRedirect('/apply/')
Пример #3
0
def audit_view(request):
    is_administer = is_admin(request.user)
    create_application_list = CreateApplication.objects.filter(state="pending")
    create_application_num = create_application_list.count()
    create_applications = list()
    for create_application in create_application_list:
        create_applications.append(create_application.audit_info())

    delete_application_list = DeleteApplication.objects.filter(state="pending")
    delete_application_num = delete_application_list.count()
    delete_applications = list()
    for delete_application in delete_application_list:
        delete_applications.append(delete_application.audit_info())

    port_application_list = PortApplication.objects.filter(state="pending")
    port_application_num = port_application_list.count()
    port_applications = list()
    for port_application in port_application_list:
        port_applications.append(port_application.audit_info())
    return render_to_response("audit.html", locals())
Пример #4
0
def applications_view(request):
    is_administer = is_admin(request.user)
    create_application_list = CreateApplication.objects.filter(applicant=request.user)
    create_applications = list()
    for create_application in create_application_list:
        create_applications.append(create_application.application_info())

    delete_application_list = DeleteApplication.objects.filter(applicant=request.user)
    delete_applications = list()
    for delete_application in delete_application_list:
        delete_applications.append(delete_application.application_info())

    port_application_list = PortApplication.objects.filter(applicant=request.user)
    port_applications = list()
    for port_application in port_application_list:
        port_applications.append(port_application.application_info())

    operation_list = OperationRecord.objects.filter(user=request.user)
    operations = list()
    for operation in operation_list:
        operations.append(operation.get_info())
    return render_to_response('applications.html', locals())
Пример #5
0
def apply_view(request):
    is_administer = is_admin(request.user)
    return render_to_response('apply.html', locals())
Пример #6
0
def detail_view(request):
    is_administer = is_admin(request.user)
    return render_to_response('detail.html', locals())