def move_item(request, itemid): items.setowner(request.user.id) item = items.item() item.load(itemid) moveid = request.POST['moveto'] moveto = 1 if moveid != '0': move = items.item() move.load(moveid) moveto = move.sort + 1 item.move(moveto) return HttpResponse('')
def edit_item(request, itemid): items.setowner(request.user.id) item = items.item() item.load(itemid) item.update_text(request.POST['text']) return HttpResponse('')
def archive_item(request, itemid): items.setowner(request.user.id) item = items.item() item.load(itemid) item.set_archived() return HttpResponse('')
def reparent_item(request, itemid): items.setowner(request.user.id) item = items.item() item.load(itemid) item.reparent(request.POST['parentid']) return HttpResponse('')
def create_item(request, parentid): items.setowner(request.user.id) item = items.item() item.set_data(request.POST) # Check text was actually entered if item.validate(): item.save(parentid) return HttpResponse('')
mc.execute( """ ALTER TABLE `data` CHANGE `createdold` `updated` TIMESTAMP NULL DEFAULT NULL """ ) set_current_version(upgradeto) upgradeto = 2011052803 if version < upgradeto: items.setowner(2) print 'Update "sort" column for existing data' new = items.item() new.id = 0 new.sort_children() mc.execute( """ SELECT * FROM `data` WHERE `data`.`archive` = 0 ORDER BY `id` ASC """ )