def manga_delete(self, id):
     db = Database()
     manga = db.retrieve(Manga, Manga.id, id)
     db.delete(manga, Manga)
     raise cherrypy.HTTPRedirect('/')
 def manga_delete(self, id):
     db = Database()
     manga = db.retrieve(Manga, Manga.id, id)
     db.delete(manga, Manga)
     raise cherrypy.HTTPRedirect('/')
Exemplo n.º 3
0
        if action == 2:
            print("Choisissez ce que vous voulez supprimer ?")
            print("1 - Manga")
            print("2 - Tome")
            action = int(input("Choix ?"))
            if action == 1:
                id = input("Id du manga a supprimer ?")
                manga = db.retrieve(Manga, Manga.id, id)
                if manga != None:
                    confirmation = bool(
                        input(
                            "Voulez vous vraiment supprimer le manga {}, tous les tomes associé seront supprimés ?"
                            .format(manga.titre)))
                    if confirmation == True:
                        db.delete(manga, Manga)
            if action == 2:
                manga = input("Id de la serie ?")
                numero = input("Numéro du tome ?")
                tome = db.retrieveTome(manga, numero)
                if tome != None:
                    nom = db.retrieve(Manga, Manga.id, manga).titre
                    confirmation = bool(
                        input(
                            "Voulez vous vraiment supprimer le tome {} de {} ?"
                            .format(numero, nom)))
                    if confirmation == True:
                        db.deleteTome(tome)
                action = 0

            if action == 3:
                comment = Commentaire(commentaire,titre, id)
                db.create(comment, Commentaire)
                action = 0

        if action == 2:
            print("Choisissez ce que vous voulez supprimer ?")
            print("1 - Manga")
            print("2 - Tome")
            action = int(input("Choix ?"))
            if action == 1:
                id = input("Id du manga a supprimer ?")
                manga = db.retrieve(Manga, Manga.id, id)
                if manga != None:
                    confirmation = bool(input("Voulez vous vraiment supprimer le manga {}, tous les tomes associé seront supprimés ?".format(manga.titre)))
                    if confirmation == True:
                        db.delete(manga, Manga)
            if action == 2 :
                manga = input("Id de la serie ?")
                numero = input("Numéro du tome ?")
                tome = db.retrieveTome(manga,numero)
                if tome != None:
                    nom = db.retrieve(Manga, Manga.id, manga).titre
                    confirmation = bool(input("Voulez vous vraiment supprimer le tome {} de {} ?".format(numero, nom)))
                    if confirmation == True:
                        db.deleteTome(tome)
                action = 0

            if action == 3:
                action = None
                liste = db.retrieve(Manga)
                for i in liste: