Exemplo n.º 1
0
def delete_category(category):
    query = Categories.select(
        Categories.name).where(Categories.name == category)
    if query.exists():
        get_save_id = Categories.select(
            Categories.id).where(Categories.name == category)
        Categories.delete().where(Categories.name == category).execute()
        MoviesCategory.delete().where(
            MoviesCategory.movie_id == get_save_id).execute()
        return 'DONE'
    return "Genre doesnt exists"
Exemplo n.º 2
0
def delete_post(id):

    if users.is_current_user_admin():
        posts = Posts()

        tags = Tags()

        categories = Categories()

        updating_post = BlogPost.get(int(id))

        categories.delete(updating_post.category)

        posts.delete(updating_post.key)

        tags.update([])

    return jsonify(msg="OK")
Exemplo n.º 3
0
def delete_post(id):

    if users.is_current_user_admin():
        posts = Posts()

        tags = Tags()

        categories = Categories()

        updating_post = BlogPost.get(int(id))

        categories.delete(updating_post.category)

        posts.delete(updating_post.key)

        tags.update(updating_post.get_tag_names())

    return jsonify(msg="OK")