示例#1
0
文件: views.py 项目: srynot4sale/iron
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('')
示例#2
0
文件: views.py 项目: srynot4sale/iron
def edit_item(request, itemid):

    items.setowner(request.user.id)

    item = items.item()
    item.load(itemid)
    item.update_text(request.POST['text'])

    return HttpResponse('')
示例#3
0
文件: views.py 项目: srynot4sale/iron
def archive_item(request, itemid):

    items.setowner(request.user.id)

    item = items.item()
    item.load(itemid)
    item.set_archived()

    return HttpResponse('')
示例#4
0
文件: views.py 项目: srynot4sale/iron
def reparent_item(request, itemid):

    items.setowner(request.user.id)

    item = items.item()
    item.load(itemid)
    item.reparent(request.POST['parentid'])

    return HttpResponse('')
示例#5
0
文件: views.py 项目: srynot4sale/iron
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('')
示例#6
0
    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
        """
    )