def tome_buy(self, id_manga, id_tome): db = Database() tome = db.retrieveTome(id_manga, id_tome) tome.a_acheter = False tome.possede = True db.update() raise cherrypy.HTTPRedirect('/collection/')
def shopping_list_comfirm(self): db = Database() tomes = db.retrieveTome() for tome in tomes: if tome.a_acheter == True: tome.a_acheter = False tome.possede = True db.update() raise cherrypy.HTTPRedirect('/')
def tome_read(self, id_manga, id_tome): db = Database() tome = db.retrieveTome(id_manga, id_tome) tome.lu = True db.update() raise cherrypy.HTTPRedirect('/')
def tome_cart(self, id_manga, id_tome): db = Database() tome = db.retrieveTome(id_manga, id_tome) tome.a_acheter = True db.update() raise cherrypy.HTTPRedirect('/shopping_list/')
def tome_delete(self, id_manga, id_tome): db = Database() tome = db.retrieveTome(id_manga, id_tome) db.deleteTome(tome) raise cherrypy.HTTPRedirect('/')
def tome_detail(self, id_manga, id_tome): db = Database() tome = db.retrieveTome(id_manga,id_tome) return _tome_detail.render_unicode(tome = tome)
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: print(i)
def tome_detail(self, id_manga, id_tome): db = Database() tome = db.retrieveTome(id_manga, id_tome) return _tome_detail.render_unicode(tome=tome)
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: print(i) id = input("Id manga ?") commentaire = db.retrieve(Commentaire, Commentaire.id, id) if commentaire != None: