Пример #1
0
def delete_list(request,list_name):
    if request.is_ajax() and request.method == 'POST':
        itemid = request.POST.get('id', 555)
        listItems = ListModel.objects()
        for item in listItems:
            if(item.list_id==int(itemid)):
                item.delete()
            elif(item.list_id>int(itemid)):
                item.list_id = item.list_id -1
                item.save()
    return HttpResponse("haha")
Пример #2
0
def updata_list(request,list_name):
    if request.is_ajax() and request.method == 'POST':
        text = request.POST.get('item', 'qw')
        print(text)
        itemid = request.POST.get('id', 555)
        print(int(itemid))
    listItems = ListModel.objects()
    for item in listItems:
        if(item.list_id==int(itemid)):
            updetaItem = item
    updetaItem.list_item = str(text)
    updetaItem.save()
    return HttpResponse("haha")