def update_video_category(id, name):
    s = start_session()

    s.query(VideoCategory).filter(VideoCategory.id == id).update(
        {'name': name})

    close_session(s)
def update_symbol_category(id, name):
    s = start_session()

    s.query(SymbolCategory).filter(SymbolCategory.id == id).update({
        'name': name
    })

    close_session(s)
def update_author(id, name, biography):
    s = start_session()

    s.query(Author).filter(Author.id == id).update({
        'name': name,
        'biography': biography
    })

    close_session(s)
def update_user(uid, name, document, phone, business_name):
    s = start_session()

    s.query(User).filter(User.uid == uid).update({
        'name': name,
        'document': document,
        'phone': phone,
        'business_name': business_name
    })

    close_session(s)
Esempio n. 5
0
def update_symbol_subcategory(id, name, category_id):
    s = start_session()

    s.query(SymbolSubcategory).filter(SymbolSubcategory.id == id).update({
        'name':
        name,
        'category_id':
        category_id
    })

    close_session(s)
def update_video(id, title, youtube_url, subcategory_id):
    s = start_session()

    s.query(Video).filter(Video.id == id).update({
        'title':
        title,
        'youtube_url':
        youtube_url,
        'subcategory_id':
        subcategory_id
    })

    close_session(s)
def update_ad(id, text, img, url):
    s = start_session()
    if img == None:
        ad = get_ad(id)
        img_path = ad['img']
    else:
        img_path = storage.upload_image_file(img, "ad")

    s.query(Ad).filter(Ad.id == id).update({
        'text': text,
        'img': img_path,
        'url': url
    })

    close_session(s)
Esempio n. 8
0
def update_symbol(id, title, body, img, subcategory_id):
    s = start_session()
    if img == None:
        symbol = get_symbol(id)
        img_path = symbol['img']
    else:
        img_path = storage.upload_image_file(img, "symbol")

    s.query(Symbol).filter(Symbol.id == id).update({
        'title': title,
        'body': body,
        'img': img_path,
        'subcategory_id': subcategory_id
    })

    close_session(s)
def update_post(id, title, body, publish_date, img, requires_login, author_id):
    s = start_session()

    if img == None:
        post = get_post(id)
        img_path = post['img']
    else:
        img_path = storage.upload_image_file(img, "post")

    s.query(Post).filter(Post.id == id).update({
        'title': title,
        'body': body,
        'publish_date': publish_date,
        'img': img_path,
        'requires_login': requires_login == 'true',
        'author_id': author_id
    })

    close_session(s)
def approve_post(id):
    s = start_session()
    s.query(ForumPost).filter(ForumPost.id == id).update({'approved': True})

    close_session(s)
def remove_post(id):
    s = start_session()
    s.query(ForumPost).filter(ForumPost.id == id).update(
        {'body': 'Este post foi deletado.'})

    close_session(s)