Пример #1
0
def insert(request):
    try:
        ob = Types()
        ob.name = request.POST['name']
        ob.pid = request.POST['pid']
        ob.path = request.POST['path']
        ob.save()
        context = {"info": "添加成功!"}
    except Exception as e:
        print(e)
        context = {"err": "添加失败!"}
    return render(request, "myadmin/info.html", context)
Пример #2
0
def insert(request):
    try:
        ob = Types()
        ob.name = request.POST['name']
        ob.pid = request.POST['pid']
        ob.path = request.POST['path']
        ob.save()
        context = {'info': '添加成功!'}
    except Exception as err:
        print(err)
        context = {'info': '添加失败!'}
    return render(request, 'myadmin/info.html', context)
Пример #3
0
def insert(request):
    '''添加数据'''
    try:
        ob = Types()
        ob.name = request.POST['name']
        ob.pid = request.POST['pid']
        ob.path = request.POST['path']
        ob.save()
        context = {'info': '添加成功'}
    except Exception as err:
        context = {"info": '添加失败'}
    return render(request, 'myadmin/info.html', context)
Пример #4
0
def insert(request):
    """执行添加"""
    try:
        ob = Types()
        ob.name = request.POST['categoryName']
        ob.pid = request.POST['PID']
        ob.path = request.POST['PATH']
        ob.save()
        return redirect('/types')
    except Exception as err:
        print(err)
        context = {'Info': 'Addition Failed', 'Detail': err}
        return render(request, 'backstage/info.html', context)
Пример #5
0
def insert(request):
    '''执行添加操作'''
    try:
        types = Types()
        types.name = request.POST['name']
        types.pid = request.POST['pid']
        types.path = request.POST['path']
        types.save()
        context = {'info': '添加成功!'}
    except Exception as err:
        print(f'错误原因是:{err}')
        context = {'info': '添加失败!'}
    return render(request, './myadmin/types/info.html', context)
Пример #6
0
def insert(request):
    try:
        #新增商品类别信息
        list = Types()
        list.name = request.POST['txt_name']
        list.pid = request.POST['txt_pid']
        list.path = request.POST['txt_path'] + request.POST['txt_pid'] + ','
        list.save()
        info = "保存成功!"
        context = {"info": info}
        return render(request, "mymanage/info.html", context)
    except Exception as info:
        context = {"info": info}
        return render(request, "mymanage/info.html", context)
Пример #7
0
def insert(request):
    '''
    添加商品类型
    :param request:
    :param tid:
    :return:
    '''
    try:
        type = Types()
        type.name = request.POST['name']
        type.pid = request.POST['pid']
        if type.pid == '0':
            type.path = request.POST["path"]
        else:
            type.path = request.POST["path"] + type.pid + ","
        type.save()
    except Exception as err:
        print(err)
    return redirect(reverse('console_type_index'))
Пример #8
0
def insert(request):
    '''执行添加信息'''
    try:
        ob = Types()
        ob.name = request.POST['name']
        ob.pid = request.POST['pid']

        ob.path = request.POST['path']

        ob.save()
        context = {"info": "添加成功"}

    except Exception as err:

        print(err)
        context = {"info": "添加失败"}
    return render(request, 'myadmin/info.html', context)
Пример #9
0
def insert(httpRequest):
    '''执行添加'''
    try:
        mod = Types()
        mod.name = httpRequest.POST.get('name', None)

        mod.pid = httpRequest.POST.get('pid', None)

        mod.path = httpRequest.POST.get('path', None)
        mod.save()
        data = {"info": '添加成功'}

    except Exception as e:
        print(e)
        data = {"info": '添加失败'}
    # return HttpResponse(mod.sex)

    return render(httpRequest, 'myadmin/info.html', data)