Пример #1
0
def delete_content_block(cid):
    ret = True
    cb = ContentBlock.get_by_id(cid)
    if cb:
        cb.delete()
    else:
        ret = False
    if cb.category in ['header', 'footer']:
        ret = {'reload': True}
    return ret
Пример #2
0
def management_section_edit(section_id, args):
    curr_user = auth.current_user.username
    if int(section_id) > 0:
        cb = ContentBlock.get_by_id(int(section_id))
    else:
        cb = ContentBlock()
        cb.cid = 0
        cb.title = 'New block'
        cb.content = ''
        cb.category = args if args else 'block'
        cb.weight = 1
    return bottle.template('./templates/admin_content_detail',
        username=curr_user,
        pathname=bottle.request.path,
        block = cb
    )