def add(self): print('Dodawanie książki') print('-----------------') title = input('Tytuł:') isbn = input('ISBN(13):') description = input('Opis (opcjonalnie):') publisher = Publisher().get_or_create( name=input('Nazwa wydawnictwa: '))[0] # pętla do dodawania autoróœ next_author = 't' authors = [] while next_author == 't': authors.append(input("Imię i nazwisko autora: ")) next_author = input('Następny autor? [t/n]') authors = self.add_authors(authors) book = Book(title=title, isbn=isbn, description=description, publisher=publisher) book.save() book.authors = authors book.update() return book.id
def add(self): title = input('Podaj tytuł: ') isbn = input('Podaj ISBN: ') description = input('Opis (opcjonalnie): ') publisher = Publisher().get_or_create(name = input('Nazwa wydawnictwa:'))[0] next_author = 't' authors = [] while next_author == 't': authors.append(input('Imię i nazwisko autora: ')) next_author = input('Następny autor? [t/n]') authors = self.add_authors(authors) book = Book(title=title, isbn=isbn, description=description, publisher=publisher) book.save() book.authors = authors book.update() return book.id
def add(self): print('Dodawanie książki') print('-----------------') title: str = input("Tytuł: ") isbn: str = input("ISBN: ") try: pages = int(input("Stron: ")) except ValueError: pages = None try: published = int(input("Rok wydania [yyyy]: ")) except ValueError: published = None authors: List[Author] = self._add_authors() book = Book(title=title, isbn=isbn, pages=pages, published=published) book.save() book.authors = authors book.update()