def remove_anime(title): anime_data = request.get_json(force=True, silent=True) if anime_data == None: return "Bad request", 400 anime = Anime.find_by_title([title]) Anime.delete([title]) return ""
def update_anime(title): anime_data = request.get_json(force=True, silent=True) if anime_data == None: return "Bad request", 400 anime = Anime.find_by_title([title]) if "title" in anime_data: anime.title = anime_data["title"] if "studio" in anime_data: anime.studio = anime_data["studio"] if "episodes" in anime_data: anime.episodes = anime_data["episodes"] if "seasons" in anime_data: anime.seasons = anime_data["seasons"] return json.dumps(anime.save().to_dict())
def view_anime(title): return render_template("anime.html", anime=Anime.find_by_title([title]))