Example #1
0
def instance(request):
    if request.method == "GET":
        instance_list = instance_manage.InstanceGet().get_instance_list(
            None, 10)
        return render_to_response('instance.html',
                                  {'instance_list': instance_list})
    else:
        return render_to_response('instance.html')
Example #2
0
def instance_detail(request):
    if request.method == "GET":
        instance = instance_manage.InstanceGet().get_instance(request.GET)
    else:
        if request.POST.get("type") == "mod":
            instance_manage.InstanceManage(request.POST).mod_instance()
            instance = instance_manage.InstanceGet().get_instance(request.POST)
        else:
            instance_manage.InstanceManage(request.POST).stat_instance()
            instance = instance_manage.InstanceGet().get_instance_by_id()
    if instance.get("stat") == 1:
        stat_action = '下'
    else:
        stat_action = '上'
    return render_to_response('instance_detail.html', {
        "instance": instance,
        "readonly": "true",
        "stat_action": stat_action
    },
                              context_instance=RequestContext(request))
Example #3
0
def database_add(request):
    instance_list = instance_manage.InstanceGet().get_instance_list(
        None)  #.values("id","ip","port")
    business_list = business_manage.BusinessGet().get_business_list(
        None).values("id", "name")
    if request.method == "GET":
        return render_to_response('database_add.html', {
            "instance_list": instance_list,
            "business_list": business_list
        },
                                  context_instance=RequestContext(request))
    else:
        (result,
         msg) = database_manage.DatabaseManage(request.POST).add_database()
        return render_to_response('database_add.html', {
            "msg": msg,
            "instance_list": instance_list,
            "business_list": business_list
        },
                                  context_instance=RequestContext(request))