def _genre(args, file: TextIO = sys.stdout): genre: Optional[Genre] = None if args.subparser == "add": genre, created = Genre.from_dict({"name": args.name}) if created: stdout.write( _('Successfully added genre "%(name)s" with id "%(pk)d".') % {"name": genre.name, "pk": genre.pk}, "=", ) genre.print(file) else: stdout.write( _('The genre "%(name)s" already exists with id "%(pk)d", aborting...') % {"name": genre.name, "pk": genre.pk}, "", ) elif args.subparser == "delete": genre = Genre.get(args.genre) if genre: genre.delete() stdout.write( _('Successfully deleted genre with id "%(pk)d".') % {"pk": genre.pk}, "" ) else: stdout.write(_("No genre found."), "") elif args.subparser == "edit": genre = Genre.get(args.genre) if genre: genre.edit(args.field, args.value) stdout.write( _('Successfully edited genre "%(name)s" with id "%(pk)d".') % {"name": genre.name, "pk": genre.pk}, "", ) genre.print(file) else: stdout.write(_("No genre found."), "") elif args.subparser == "info": genre = Genre.get(args.genre) if genre: genre.print(file) else: stdout.write(_("No genre found."), "") elif args.subparser == "list": if args.search: genres = Genre.search(args.search) else: genres = Genre.objects.all() stdout.write([_("Id"), _("Name")], "=", [0.05], file=file) for i, has_next in lookahead(genres): stdout.write([i.id, i.name], "_" if has_next else "=", [0.05], file=file)
def from_dict(cls: Type[T], data: Dict) -> Tuple[T, bool]: """Create from dict. Returns True if was crated, i. e. was not found in the DB. """ defaults: Dict = {} if "series" in data and data["series"]: defaults["series"] = Series.from_dict(data["series"])[0] if "volume" in data and data["volume"]: defaults["volume"] = data["volume"] book, created = Book.objects.get_or_create(title=data["title"], defaults=defaults) if "authors" in data and data["authors"]: for i in data["authors"]: book.authors.add(Person.from_dict(i)[0]) if "genres" in data and data["genres"]: for i in data["genres"]: book.genres.add(Genre.from_dict(i)[0]) if "links" in data and data["links"]: for i in data["links"]: book.links.add(Link.from_dict(i)[0]) return book, created
def edit(self: T, field: str, value: Union[str, float], *args, **kwargs): """Change field by given value.""" assert field in [ "title", "author", "series", "volume", "genre", "link" ] if field == "title": self.title = value elif field == "author" and isinstance(value, str): author = Person.get_or_create(value) if self.authors.filter(pk=author.pk).exists(): self.authors.remove(author) else: self.authors.add(author) elif field == "series" and isinstance(value, str): self.series = Series.get_or_create(value) elif field == "volume": self.volume = value elif field == "genre" and isinstance(value, str): genre = Genre.get_or_create(value) if self.genres.filter(pk=genre.pk).exists(): self.genres.remove(genre) else: self.genres.add(genre) elif field == "link" and isinstance(value, str): link = Link.get_or_create(value) if self.links.filter(pk=link.pk).exists(): self.links.remove(link) else: self.links.add(link) self.save(*args, **kwargs)
def test_search(self): genre, created = Genre.from_dict({"name": "Science Fiction"}) self.assertTrue(created) self.assertIsNotNone(genre.id) genre, created = Genre.from_dict({"name": "Romance"}) self.assertTrue(created) self.assertIsNotNone(genre.id) genre, created = Genre.from_dict({"name": "Fiction"}) self.assertTrue(created) self.assertIsNotNone(genre.id) self.assertEquals(3, Genre.objects.all().count()) self.assertEquals(2, Genre.search("fiction").count()) self.assertEquals(2, Genre.search("ce").count())
def test_get(self): genre, created = Genre.from_dict({"name": "Science Fiction"}) self.assertTrue(created) self.assertIsNotNone(genre.id) genre2 = Genre.get("Science Fiction") self.assertIsNotNone(genre2) self.assertEquals(genre, genre2) genre2 = Genre.get("fiction") self.assertIsNotNone(genre2) self.assertEquals(genre, genre2) genre2 = Genre.get(str(genre.id)) self.assertIsNotNone(genre2) self.assertEquals(genre, genre2)
def test_delete(self): genre, created = Genre.from_dict({"name": "Fiction"}) self.assertTrue(created) self.assertIsNotNone(genre.id) deleted = genre.delete() self.assertIsNone(genre.id) self.assertEquals((1, {"genres.Genre": 1}), deleted)
def test_save(self): genre = Genre(name="Science Fiction") genre.save() self.assertIsNotNone(genre.id) self.assertEquals("science-fiction", genre.slug) genre = Genre(name="Fiction") genre.save() self.assertIsNotNone(genre.id) self.assertEquals("fiction", genre.slug)
def test_get_or_create(self): genre, created = Genre.from_dict({"name": "Science Fiction"}) self.assertTrue(created) self.assertIsNotNone(genre.id) self.assertEquals(1, Genre.objects.count()) genre2 = Genre.get_or_create("Science Fiction") self.assertIsNotNone(genre2) self.assertEquals(genre, genre2) self.assertEquals(1, Genre.objects.count()) genre2 = Genre.get_or_create(str(genre.id)) self.assertIsNotNone(genre2) self.assertEquals(genre, genre2) self.assertEquals(1, Genre.objects.count()) genre2 = Genre.get_or_create("SciFi") self.assertIsNotNone(genre2) self.assertNotEquals(genre, genre2) self.assertEquals(2, Genre.objects.count())
def test_print(self): genre, created = Genre.from_dict({"name": "Science Fiction"}) self.assertTrue(created) self.assertIsNotNone(genre.id) with StringIO() as cout: genre.print(cout) self.assertEquals( "Field Value " + " \n==================================" + "==================================================================\n" + "Id 1 " + " \n__________________________________" + "__________________________________________________________________\n" + "Name Science Fiction " + " \n__________________________________" + "__________________________________________________________________\n" "Books " + " \n__________________________________" + "__________________________________________________________________\n", cout.getvalue(), )
def test_from_to_dict(self): book, created = Book.objects.get_or_create(title="Cool") self.assertTrue(created) self.assertIsNotNone(book.id) self.assertEquals( { "title": "Cool", "authors": None, "series": None, "volume": 0, "genres": None, "links": None, }, book.to_dict(), ) self.assertEquals((book, False), Book.from_dict(book.to_dict())) self.assertEquals((book, False), Book.from_dict({"title": "Cool"})) author, created = Person.from_dict({"name": "Max Mustermann"}) self.assertTrue(created) self.assertIsNotNone(author.id) series, created = Series.from_dict({"name": "Secret Files"}) self.assertTrue(created) self.assertIsNotNone(series.id) genre, created = Genre.from_dict({"name": "Fiction"}) self.assertTrue(created) self.assertIsNotNone(genre.id) link, created = Link.from_dict({"url": "https://example.com"}) self.assertTrue(created) self.assertIsNotNone(link.id) book, created = Book.objects.get_or_create(title="Example", series=series, volume=1) book.authors.add(author) book.genres.add(genre) book.links.add(link) self.assertTrue(created) self.assertIsNotNone(book.id) self.assertEquals( { "title": "Example", "authors": [{ "name": "Max Mustermann", "links": None }], "series": { "name": "Secret Files", "links": None }, "volume": 1, "genres": [{ "name": "Fiction" }], "links": [{ "url": "https://example.com" }], }, book.to_dict(), ) self.assertEquals((book, False), Book.from_dict(book.to_dict()))
# Add Authors for x in range(0, 20): author = Author( first_name=fake.first_name(), last_name=fake.last_name(), about=fake.paragraphs(nb=2), ) author.save() # Add Genre genre_list = ['Action', 'Literary', 'Romance', 'Humor', 'Science', 'History', 'Cooking', 'Graphic Novel'] for word in genre_list: genre = Genre(name=word, about=fake.paragraphs(nb=1)) genre.save() # Add Publisher for x in range(0, 11): publisher = Publisher(name=fake.company(), about=fake.paragraphs(nb=2)) publisher.save() # Add Books for x in range(0, 101): rand_auth = randint(1, 20) author_query = Author.objects.get(id=rand_auth) rand_pub = randint(1, 10) publish_query = Publisher.objects.get(id=rand_pub)
def _book(args: Namespace, file: TextIO = sys.stdout): book: Optional[Book] = None if args.subparser == "add": book, created = Book.from_dict({ "title": args.title, "authors": [Person.get_or_create(author).to_dict() for author in args.author], "series": Series.get_or_create(args.series).to_dict() if args.series else None, "volume": args.volume, "genres": [Genre.get_or_create(genre).to_dict() for genre in args.genre], "links": [Link.get_or_create(link).to_dict() for link in args.link], }) if created: stdout.write( _('Successfully added book "%(title)s" with id "%(pk)d".') % { "title": book.title, "pk": book.pk }, "=", file=file, ) book.print(file) else: stdout.write( _('The book "%(title)s" already exists with id "%(pk)d", aborting...' ) % { "title": book.title, "pk": book.pk }, "", file=file, ) elif args.subparser == "delete": book = Book.get(args.book) if book: book.delete() stdout.write( _('Successfully deleted book "%(title)s" with id "%(pk)d".') % { "title": book.title, "pk": book.pk }, "", file=file, ) else: stdout.write(_("No book found."), "", file=file) elif args.subparser == "edit": book = Book.get(args.book) if book: book.edit(args.edit_subparser, args.value) stdout.write( _('Successfully edited book "%(title)s" with id "%(pk)d".') % { "title": book.title, "pk": book.pk }, "=", file=file, ) book.print(file) else: stdout.write(_("No book found."), "", file=file) elif args.subparser == "edition": book = Book.get(args.book) if book: if args.edition_subparser == "acquisition" and book: edition = Edition.get(args.edition, book) acquisition: Optional[Acquisition] = None if args.acquisition_subparser == "add" and edition: acquisition, created = Acquisition.from_dict( { "date": args.date, "price": args.price }, edition) if created: stdout.write( _('Successfully added acquisition with id "%(pk)d".' ) % {"pk": acquisition.pk}, "=", file=file, ) else: stdout.write( _('The acquisition already exists with id "%(pk)d".' ) % {"pk": acquisition.pk}, "", file=file, ) acquisition.print(file) elif args.acquisition_subparser == "delete" and edition: acquisition = Acquisition.get(args.acquisition, editions=edition) if acquisition: acquisition.delete(acquisition) stdout.write( _('Successfully deleted acquisition with id "%(pk)d".' ) % {"pk": acquisition.pk}, "", file=file, ) else: stdout.write(_("No acquisition found."), "", file=file) elif args.acquisition_subparser == "edit" and edition: acquisition = Acquisition.get(args.acquisition, editions=edition) if acquisition: acquisition.edit(args.field, args.value) stdout.write( _('Successfully edited acquisition with id "%(pk)d".' ) % {"pk": acquisition.pk}, "=", file=file, ) acquisition.print(file) else: stdout.write(_("No acquisition found."), "", file=file) else: stdout.write([_("No edition found.")], "", file=file) elif args.edition_subparser == "add" and book: edition, created = Edition.from_dict( { "alternate_title": args.alternate_title, "isbn": args.isbn, "publishing_date": args.publishing_date, "cover": args.cover, "binding": Binding.get_or_create(args.binding).to_dict() if args.binding else None, "publisher": Publisher.get_or_create(args.publisher).to_dict() if args.publisher else None, "persons": [ Person.get_or_create(person).to_dict() for person in args.person ], "languages": [ Language.get_or_create(language).to_dict() for language in args.language ], "links": [ Link.get_or_create(link).to_dict() for link in args.link ], "files": [{ "path": file } for file in args.file], }, book, ) if created: stdout.write( _('Successfully added edition "%(edition)s" with id "%(pk)d".' ) % { "edition": edition, "pk": edition.pk }, "=", file=file, ) edition.print(file) else: stdout.write( _('The edition "%(edition)s" already exists with id "%(pk)d",' + " aborting...") % { "edition": edition, "pk": edition.pk }, "", file=file, ) elif args.edition_subparser == "edit" and book: edition = Edition.get(args.edition, book) if edition: edition.edit(args.edit_subparser, args.value) stdout.write( _('Successfully edited edition "%(edition)s" with id "%(pk)d".' ) % { "edition": edition, "pk": edition.pk }, "=", file=file, ) edition.print(file) else: stdout.write(_("No edition found."), "", file=file) elif args.edition_subparser == "info" and book: edition = Edition.get(args.edition, book) if edition: edition.print(file) else: stdout.write(_("No edition found."), "", file=file) elif args.edition_subparser == "list" and book: if args.shelf: editions = Edition.list.by_shelf(args.shelf, book) elif args.search: editions = Edition.list.by_term(args.search, book) else: editions = Edition.objects.filter(book=book) stdout.write( [ _("Id"), _("Title"), _("Binding"), _("ISBN"), _("Publishing date"), ], "=", [0.05, 0.55, 0.7, 0.85], file=file, ) for i, has_next in lookahead(editions): stdout.write( [ i.pk, i.get_title(), i.binding, i.isbn, i.publishing_date ], "_" if has_next else "=", [0.05, 0.55, 0.7, 0.85], file=file, ) elif args.edition_subparser == "open" and book: edition = Edition.get(args.edition, book) if edition: edition_file = edition.files.get(pk=args.file) path = settings.MEDIA_ROOT / edition_file.file.path if sys.platform == "linux": os.system(f'xdg-open "{path}"') else: os.system(f'open "{path}"') else: stdout.write(_("No edition found."), "", file=file) elif args.edition_subparser == "read" and book: edition = Edition.get(args.edition, book) read: Optional[Read] = None if args.read_subparser == "add" and edition: read, created = Read.from_dict( { "started": args.started, "finished": args.finished }, edition) if created: stdout.write( _('Successfully added read with id "%(pk)d".') % {"pk": read.pk}, "=", file=file, ) else: stdout.write( _('The read already exists with id "%(pk)d".') % {"pk": read.pk}, "", file=file, ) read.print(file) elif args.read_subparser == "delete" and edition: read = Read.get(args.read, editions=edition) if read: read.delete() stdout.write( _('Successfully deleted read with id "%(pk)d".') % {"pk": read.pk}, "", file=file, ) else: stdout.write(_("No read found."), "", file=file) elif args.read_subparser == "edit" and edition: read = Read.get(args.read, editions=edition) if read: read.edit(args.field, args.value) stdout.write( _('Successfully edited read with id "%(pk)d".') % {"pk": read.pk}, "=", file=file, ) read.info(file) else: stdout.write(_("No read found."), "", file=file) else: stdout.write(_("No edition found."), "", file=file) else: stdout.write(_("No book found."), "", file=file) elif args.subparser == "info": book = Book.get(args.book) if book: book.print(file) else: stdout.write(_("No book found."), "", file=file) elif args.subparser == "list": if args.search: books = Book.search(args.search) elif args.shelf: books = Book.by_shelf(args.shelf) else: books = Book.objects.all() stdout.write( [_("Id"), ("Title"), _("Authors"), _("Series"), _("Volume")], "=", [0.05, 0.5, 0.75, 0.9], file=file, ) for i, has_next in lookahead(books): stdout.write( [ i.pk, i.title, " ,".join(f"{a}" for a in i.authors.all()), i.series.name if i.series else "", i.volume, ], "_" if has_next else "=", [0.05, 0.5, 0.75, 0.9], file=file, )
def test_from_to_dict(self): genre, created = Genre.objects.get_or_create(name="Fiction") self.assertTrue(created) self.assertIsNotNone(genre.id) self.assertEquals({"name": "Fiction"}, genre.to_dict()) self.assertEquals((genre, False), Genre.from_dict({"name": "Fiction"}))
def create_initial_data(request): #usuarios Admin userAndy = User(username="******", password="******", first_name="Andy", last_name="Castillo", email="*****@*****.**", is_staff=True) userAndy.save() userAndy.set_password("12345") userAndy.save() userMarco = User(username="******", password="******", first_name="Marco", last_name="Fuentes", email="*****@*****.**", is_staff=True) userMarco.save() userMarco.set_password("12345678") userMarco.save() #Awards awardGoty = Award(name="Game Award", entity="The Game Awards", category="Juego del año", year=2019) awardGoty.save() awardBestMovie = Award(name="Oscar", entity="The Academy", category="Mejor película", year=2019) awardBestMovie.save() awardBestActionMovie = Award(name="Oscar", entity="The Academy", category="Mejor película de acción", year=2019) awardBestActionMovie.save() awardBestSerie = Award(name="Emmy", entity="Television Academy", category="Mejor serie", year=2019) awardBestSerie.save() awardBestActor2019 = Award(name="Oscar", entity="The Academy", category="Mejor actor", year=2019) awardBestActor2019.save() awardBestActress2019 = Award(name="Oscar", entity="The Academy", category="Mejor actriz", year=2019) awardBestActress2019.save() awardBestShooter = Award(name="Game Award", entity="The Game Awards", category="Mejor shooter", year=2019) awardBestShooter.save() awardBestDirector = Award(name="Oscar", entity="The Academy", category="Mejor director", year=2019) awardBestDirector.save() awardBestActor2018 = Award(name="Oscar", entity="The Academy", category="Mejor actor", year=2019) awardBestActor2018.save() awardBestActress2018 = Award(name="Oscar", entity="The Academy", category="Mejor actriz", year=2018) awardBestActress2018.save() #Consoles consoleXboxOne = Console(name="Xbox One",release_date="2013-11-22", brand="Microsoft") consoleXboxOne.save() consolePS4 = Console(name="PlayStation 4",release_date="2013-11-15", brand="Sony") consolePS4.save() consoleSwitch = Console(name="Switch",release_date="2017-03-03", brand="Nintendo") consoleSwitch.save() console64 = Console(name="Nintendo 64",release_date="1996-06-23", brand="Nintendo") console64.save() consoleXbox360 = Console(name="Xbox 360",release_date="2005-11-22", brand="Microsoft") consoleXbox360.save() consolePS3 = Console(name="PlayStation 3",release_date="2006-11-11", brand="Sony") consolePS3.save() consolePc = Console(name="PC",release_date="1950-09-21", brand="Variado") consolePc.save() #Géneros genreAction = Genre(name="Acción") genreAction.save() genreThriller = Genre(name="Thriller") genreThriller.save() genreAdventure = Genre(name="Aventura") genreAdventure.save() genreHorror = Genre(name="Horror") genreHorror.save() genreComedy = Genre(name="Comedia") genreComedy.save() genreRomantic = Genre(name="Romance") genreRomantic.save() genreShooter = Genre(name="Disparos") genreShooter.save() genrePlatform = Genre(name="Plataformas") genrePlatform.save() genreMusical = Genre(name="Musical") genreMusical.save() genreDrama = Genre(name="Drama") genreDrama.save() genreSport = Genre(name="Deporte") genreSport.save() #Developers developerActivision= Developer(name="Activision", country="Estados Unidos", year_founded=1979) developerActivision.save() developerBlizzard= Developer(name="Blizzard", country="Estados Unidos", year_founded=1991) developerBlizzard.save() developerEA= Developer(name="Electronic Arts", country="Estados Unidos", year_founded=1982) developerEA.save() developerUbisoft= Developer(name="Ubisoft", country="Francia", year_founded=1986) developerUbisoft.save() developerNintendo= Developer(name="Nintendo", country="Japón", year_founded=1889) developerNintendo.save() developerRockstar= Developer(name="Rockstar Games", country="Estados Unidos", year_founded=1998) developerRockstar.save() developerNaughty= Developer(name="Naughty Dog", country="Estados Unidos", year_founded=1986) developerNaughty.save() developerSquareEnix= Developer(name="Square Enix", country="Japón", year_founded=1975) developerSquareEnix.save() developerBethesda= Developer(name="Bethesda Game Studios", country="Estados Unidos", year_founded=2001) developerBethesda.save() #Movie producers movieProducerLucasfilm = MovieProducer(name="Lucasfilm", country="Estados Unidos", year_founded=1971) movieProducerLucasfilm.save() movieProducerMarvel = MovieProducer(name="Marvel Studios", country="Estados Unidos", year_founded=2007) movieProducerMarvel.save() movieProducerDisney = MovieProducer(name="Walt Disney Pictures", country="Estados Unidos", year_founded=1923) movieProducerDisney.save() movieProducerUniversal = MovieProducer(name="Universal Studios", country="Estados Unidos", year_founded=1912) movieProducerUniversal.save() movieProducerFox = MovieProducer(name="20th Century Fox", country="Estados Unidos", year_founded=1935) movieProducerFox.save() movieProducerColumbia = MovieProducer(name="Columbia Pictures", country="Estados Unidos", year_founded=1924) movieProducerColumbia.save() #Directores directorAnthony = Director(name="Anthony", lastName="Russo",birthDate="1970-02-03", birthPlace="Estados Unidos", netWorth="500000", height=1.70, nickname="Rus") directorAnthony.save() directorAnthony.awards.add(awardBestDirector) directorAnthony.save() directorSpielberg = Director(name="Steven", lastName="Spielberg",birthDate="1946-12-18", birthPlace="Estados Unidos", netWorth="1000000", height=1.80, nickname="Steve") directorSpielberg.save() directorSpielberg.awards.add(awardBestDirector) directorSpielberg.save() directorMartin = Director(name="Martin", lastName="Scorsese",birthDate="1942-11-17", birthPlace="Estados Unidos", netWorth="250000", height=1.75, nickname="Bart") directorMartin.save() directorLucas = Director(name="George", lastName="Lucas",birthDate="1944-05-14", birthPlace="Estados Unidos", netWorth="1100000", height=1.85, nickname="Luke") directorLucas.save() directorJohn = Director(name="John", lastName="Lasseter",birthDate="1957-01-12", birthPlace="Estados Unidos", netWorth="300000", height=1.77, nickname="Johnny") directorJohn.save() #Actores actorDiCaprio = Actor(name="Leonardo", lastName="DiCaprio", birthDate="1974-11-11", birthPlace="Estados Unidos", netWorth=1000000, height=1.85, nickname="Leo") actorDiCaprio.save() actorDiCaprio.awards.add(awardBestActor2018) actorDiCaprio.save() actorIronMan = Actor(name="Robert", lastName="Downey Jr", birthDate="1965-04-04", birthPlace="Estados Unidos", netWorth=900000, height=1.82, nickname="Iron Man") actorIronMan.save() actorIronMan.awards.add(awardBestActor2019) actorIronMan.save() actorRey = Actor(name="Daisy", lastName="Ridley", birthDate="1992-04-10", birthPlace="Inglaterra", netWorth=800000, height=1.80, nickname="Rey") actorRey.save() actorRey.awards.add(awardBestActress2018, awardBestActor2019) actorRey.save() actorOwen = Actor(name="Owen", lastName="Wilson", birthDate="1968-11-18", birthPlace="Estados Unidos", netWorth=750000, height=1.81, nickname="Wil") actorOwen.save() actorPratt = Actor(name="Chris", lastName="Pratt", birthDate="1979-06-21", birthPlace="Estados Unidos", netWorth=600000, height=1.90, nickname="Star Lord") actorPratt.save() actorSpiderMan = Actor(name="Tom", lastName="Holland", birthDate="1996-06-01", birthPlace="Inglaterra", netWorth=800000, height=1.73, nickname="Spider Man") actorSpiderMan.save() actorJennifer = Actor(name="Jennifer", lastName="Aniston", birthDate="1969-02-11", birthPlace="Estados Unidos", netWorth=600000, height=1.75, nickname="Jen") actorJennifer.save() actorJennifer.awards.add(awardBestActress2018) actorJennifer.save() actorSpiderMan = Actor(name="Tom", lastName="Holland", birthDate="1996-06-01", birthPlace="Inglaterra", netWorth=800000, height=1.73, nickname="Spider Man") actorSpiderMan.save() actorSandraBullock = Actor(name="Sandra", lastName="Bullock", birthDate="1964-07-26", birthPlace="Estados Unidos", netWorth=840000, height=1.78, nickname="Sandy") actorSandraBullock.save() actorPhoenix = Actor(name="Joaquin", lastName="Phoenix", birthDate="1974-10-28", birthPlace="Puerto Rico", netWorth=600400, height=1.81, nickname="Joker") actorPhoenix.save() actorTheRock = Actor(name="Dwayne", lastName="Johnson", birthDate="1972-05-02", birthPlace="Estados Unidos", netWorth=900000, height=1.93, nickname="The Rock") actorTheRock.save() actorIt = Actor(name="Bill", lastName="Sakrsgard", birthDate="1990-08-06", birthPlace="Suecia", netWorth=300000, height=1.78, nickname="Clown") actorIt.save() actorBlunt = Actor(name="Emily", lastName="Blunt", birthDate="1983-02-23", birthPlace="Inglaterra", netWorth=600000, height=1.70, nickname="Emmy") actorBlunt.save() actorTroy = Actor(name="Zac", lastName="Efron", birthDate="1987-10-18", birthPlace="Estados Unidos", netWorth=600000, height=1.83, nickname="Troy") actorTroy.save() actorWolverine = Actor(name="Hugh", lastName="Jackman", birthDate="1968-10-12", birthPlace="Australia", netWorth=580000, height=1.82, nickname="Logan") actorWolverine.save() actorZendaya = Actor(name="Zendaya", lastName=".", birthDate="1996-09-01", birthPlace="Estados Unidos", netWorth=700000, height=1.80, nickname="MJ") actorZendaya.save() actorFlash = Actor(name="Grant", lastName="Gustin", birthDate="1990-01-14", birthPlace="Estados Unidos", netWorth=600000, height=1.84, nickname="Flash") actorFlash.save() actorDark = Actor(name="Louis", lastName="Hofmann", birthDate="1997-01-03", birthPlace="Alemania", netWorth=400000, height=1.82, nickname="Lou") actorDark.save() actorBreaking = Actor(name="Bryan", lastName="Cranston", birthDate="1956-03-07", birthPlace="Estados Unidos", netWorth=750000, height=1.88, nickname="Walter") actorBreaking.save() actorTWD = Actor(name="Andrew", lastName="Lincoln", birthDate="1973-09-14", birthPlace="Inglaterra", netWorth=540000, height=1.87, nickname="Rick") actorTWD.save() actorStranger = Actor(name="Millie", lastName="Bobby Brown", birthDate="2004-02-19", birthPlace="Inglaterra", netWorth=500000, height=1.68, nickname="Eleven") actorStranger.save() actorGlee = Actor(name="Lea", lastName="Michele", birthDate="1986-08-29", birthPlace="Estados Unidos", netWorth=700000, height=1.78, nickname="Rachel") actorGlee.save() actorPhineas = Actor(name="Vincent", lastName="Martella", birthDate="1992-10-15", birthPlace="Estados Unidos", netWorth=500000, height=1.79, nickname="Phineas") actorPhineas.save() actorHIMYM = Actor(name="Josh", lastName="Radnor", birthDate="1974-07-29", birthPlace="Estados Unidos", netWorth=750000, height=1.84, nickname="Ted") actorHIMYM.save() actorArrow = Actor(name="Stephen", lastName="Amell", birthDate="1981-05-08", birthPlace="Canada", netWorth=790000, height=1.87, nickname="Oliver") actorArrow.save() actorWitcher = Actor(name="Henry", lastName="Cavill", birthDate="1983-05-05", birthPlace="Inglaterra", netWorth=750000, height=1.89, nickname="Superman") actorWitcher.save() actorDrake = Actor(name="Drake", lastName="Bell", birthDate="1986-06-27", birthPlace="Estados Unidos", netWorth=650000, height=1.80, nickname="Drake Campana") actorDrake.save() actorGreys = Actor(name="Ellen", lastName="Pompeo", birthDate="1969-11-10", birthPlace="Estados Unidos", netWorth=700000, height=1.80, nickname="Meredith") actorGreys.save() #Comentarios peliculas commentAndy = MovieComment(text="Yo soy Iron Man", author=userAndy) commentAndy.save() commentMarco = MovieComment(text="Buenísima 4.5 ducks", author=userMarco) commentMarco.save() commentMarcoEndgame = MovieComment(text="Buenísima, Capitán América for life", author=userMarco) commentMarcoEndgame.save() #Películas movieEndgame = Movie(name="Avengers: Endgame", rating=5.0, budget=3.5, duration=180.0, classification="PG-13", director= directorAnthony, producer=movieProducerMarvel, imageUrl="https://static.claro.com.pe/img/otros/avengersv1.jpg") movieEndgame.save() movieEndgame.award.add(awardBestMovie, awardBestActionMovie) movieEndgame.save() movieEndgame.genres.add(genreAction) movieEndgame.save() movieEndgame.comments.add(commentAndy, commentMarcoEndgame) movieEndgame.save() movieEndgame.actors.add(actorPratt, actorIronMan, actorSpiderMan) movieEndgame.save() movieStarWars9 = Movie(name="Star Wars: Episodio IX", rating=5.0, budget=3.0, duration=150.0, classification="PG-13", director= directorLucas, producer=movieProducerLucasfilm, imageUrl="https://www.estrategiaynegocios.net/csp/mediapool/sites/dt.common.streams.StreamServer.cls?STREAMOID=STh$0zrY6CxCC7NYOjHabs$daE2N3K4ZzOUsqbU5sYs4oWYPNPFH379oUI4EQNGe6FB40xiOfUoExWL3M40tfzssyZqpeG_J0TFo7ZhRaDiHC9oxmioMlYVJD0A$3RbIiibgT65kY_CSDiCiUzvHvODrHApbd6ry6YGl5GGOZrs-&CONTENTTYPE=image/jpeg") movieStarWars9.save() movieStarWars9.award.add(awardBestMovie) movieStarWars9.save() movieStarWars9.genres.add(genreAction,genreAdventure) movieStarWars9.save() movieStarWars9.comments.add(commentMarco) movieStarWars9.save() movieStarWars9.actors.add(actorRey) movieStarWars9.save() movieCars = Movie(name="Cars", rating=5.0, budget=2.0, duration=90.0, classification="G", director= directorJohn, producer=movieProducerDisney, imageUrl="https://steamcdn-a.akamaihd.net/steam/apps/331160/header.jpg?t=1571775429") movieCars.save() movieCars.actors.add(actorOwen) movieCars.save() movieCars.genres.add(genreComedy) movieCars.save() movieWallStreet = Movie(name="The Wolf of Wall Street", rating=5.0, budget=1.0, duration=180.0, classification="R", director= directorMartin, producer=movieProducerFox, imageUrl="https://lifestyle.americaeconomia.com/sites/lifestyle.americaeconomia.com/files/styles/gallery_image/public/theres-a-free-screening-of-the-wolf-of-wall-street-near-goldman-sachs-tomorrow-night-jpg.png?itok=dAk7r_Pk") movieWallStreet.save() movieWallStreet.actors.add(actorDiCaprio) movieWallStreet.save() movieWallStreet.genres.add(genreComedy) movieWallStreet.save() movieJurassicPark = Movie(name="Jurassic World", rating=5.0, budget=1.5, duration=124.0, classification="PG-13", director= directorSpielberg, producer=movieProducerUniversal, imageUrl="https://cine3-media.s3-accelerate.amazonaws.com/2014/11/teaser-jurassic-world.jpg") movieJurassicPark.save() movieJurassicPark.actors.add(actorPratt) movieJurassicPark.save() movieJurassicPark.genres.add(genreAction, genreThriller) movieJurassicPark.save() movieSpiderMan = Movie(name="Spider-Man: Homecoming", rating=5.0, budget=2.5, duration=133.0, classification="PG-13", director= directorAnthony, producer=movieProducerMarvel, imageUrl ="https://i.blogs.es/910958/nyc/450_1000.jpg") movieSpiderMan.save() movieSpiderMan.genres.add(genreAction, genreAdventure) movieSpiderMan.save() movieSpiderMan.actors.add(actorSpiderMan, actorZendaya) movieSpiderMan.save() movieBirdBox = Movie(name="Bird Box", rating=2.0, budget=1.3, duration=124.0, classification="R", director=directorMartin, producer=movieProducerUniversal, imageUrl="https://i.blogs.es/75c686/a-ciegas-cartel/1366_2000.jpg") movieBirdBox.save() movieBirdBox.genres.add(genreThriller, genreHorror) movieBirdBox.save() movieBirdBox.actors.add(actorSandraBullock) movieBirdBox.save() movieJoker = Movie(name="Joker", rating=4.0, budget=2.0, duration=122.0, classification="R", director=directorJohn, producer=movieProducerColumbia, imageUrl="https://diablorock.com/wp-content/uploads/2019/10/joker-2019-diablorock-1280x720.jpg") movieJoker.save() movieJoker.genres.add(genreThriller, genreDrama) movieJoker.save() movieJoker.actors.add(actorPhoenix) movieJoker.save() movieJumanji = Movie(name="Jumanji", rating=3.0, budget=1.5, duration=119.0, classification="PG-13", director=directorAnthony, producer=movieProducerColumbia, imageUrl="https://cdn.shopify.com/s/files/1/0747/3829/products/mL0293.jpg?v=1571444811") movieJumanji.save() movieJumanji.genres.add(genreAdventure, genreAction, genreComedy) movieJumanji.save() movieJumanji.actors.add(actorTheRock) movieJumanji.save() movieIt = Movie(name="It", rating=2.0, budget=1.9, duration=135.0, classification="R", director=directorAnthony, producer=movieProducerFox, imageUrl="https://images3.alphacoders.com/817/817146.jpg") movieIt.save() movieIt.genres.add(genreHorror) movieIt.save() movieIt.actors.add(actorIt) movieIt.save() movieQuietPlace = Movie(name="A Quiet Place", rating=4.0, budget=2.9, duration=90.0, classification="PG-13", director=directorSpielberg, producer=movieProducerUniversal, imageUrl="https://static-1.ivoox.com/audios/0/1/0/7/2781578057010_XXL.jpg") movieQuietPlace.save() movieQuietPlace.genres.add(genreHorror) movieQuietPlace.save() movieQuietPlace.actors.add(actorBlunt) movieQuietPlace.save() movieProposal = Movie(name="The Proposal", rating=4.0, budget=1.5, duration=103.0, classification="PG-13", director=directorLucas, producer=movieProducerFox, imageUrl="https://img.allw.mn/thumbs/zj/j7/ncl13aul5d40efe897eae874583552_979x979.jpg") movieProposal.save() movieProposal.genres.add(genreComedy, genreRomantic) movieProposal.save() movieProposal.actors.add(actorSandraBullock) movieProposal.save() movieTitanic = Movie(name="Titanic", rating=5.0, budget=2.5, duration=194.0, classification="PG-13", director=directorJohn, producer=movieProducerUniversal, imageUrl="https://titanicsound.files.wordpress.com/2014/11/titanic_movie-hd-1.jpg") movieTitanic.save() movieTitanic.actors.add(actorDiCaprio) movieTitanic.save() movieTitanic.genres.add(genreRomantic, genreDrama) movieTitanic.save() movieHighSchool = Movie(name="High School Musical", rating=2.0, budget=2.5, duration=198.0, classification="PG", director=directorMartin, producer=movieProducerDisney, imageUrl="https://e.radio-studio92.io/normal/2020/04/16/210621_928888.jpg") movieHighSchool.save() movieHighSchool.genres.add(genreRomantic, genreMusical) movieHighSchool.save() movieHighSchool.actors.add(actorTroy) movieHighSchool.save() movieMiserable = Movie(name="Les Misérables", rating=3.0, budget=2.2, duration=168.0, classification="PG-13", director=directorJohn, producer=movieProducerFox, imageUrl="https://www.artrix.co.uk/UserFiles/image/whatson/Les_Miserables_Movie_Wallpaper_1600x900.jpg") movieMiserable.save() movieMiserable.genres.add(genreDrama, genreMusical) movieMiserable.save() movieMiserable.actors.add(actorWolverine) movieMiserable.save() movieShowman = Movie(name="The Greatest Showman", rating=4.0, budget=2.1, duration=165.0, classification="PG", director=directorAnthony, producer=movieProducerFox, imageUrl="https://bombanoise.com/wp-content/uploads/2019/03/the-greatest-showman.jpg") movieShowman.save() movieShowman.genres.add(genreMusical, genreDrama) movieShowman.save() movieShowman.actors.add(actorWolverine, actorZendaya, actorTroy) movieShowman.save() #Comentarios Series commentAndyFriends = SerieComment(text="The Big Bang Theory es mejor", author=userAndy) commentAndyFriends.save() commentMarcoFriends = SerieComment(text="Excelente", author=userMarco) commentMarcoFriends.save() commentAndyArrow = SerieComment(text="Muy buena serie", author=userAndy) commentAndyArrow.save() #Series serieFriends = Serie(name="Friends", rating=3.0, seasons=10, classification="TV-14", director=directorJohn, imageUrl="https://smp.vgc.no/v2/images/bafa0544-7013-4f72-a167-23e409c10485?fit=crop&h=435&w=652&s=8d721fd5084ff21e67cf253f19320df0dfacdfd3") serieFriends.save() serieFriends.comments.add(commentAndyFriends, commentMarcoFriends) serieFriends.save() serieFriends.actors.add(actorJennifer) serieFriends.save() serieFriends.genres.add(genreComedy, genreRomantic) serieFriends.save() serieFriends.awards.add(awardBestSerie) serieFriends.save() serieArrow = Serie(name="Arrow", rating=5.0, seasons=8, classification="TV-14", director=directorAnthony, imageUrl="https://depor.com/resizer/cr8Nd6FcTtLiq4SSsVDnPi6Ize8=/980x528/smart/arc-anglerfish-arc2-prod-elcomercio.s3.amazonaws.com/public/IOLVRP6FNFC4BLSNQNBVWGKXBM.jpg") serieArrow.save() serieArrow.comments.add(commentAndyArrow) serieArrow.save() serieArrow.genres.add(genreAction, genreAdventure, genreDrama) serieArrow.save() serieArrow.actors.add(actorArrow) serieArrow.save() serieWitcher = Serie(name="The Witcher", rating=2.0, seasons=1, classification="TV-MA", director=directorSpielberg, imageUrl="https://occ-0-33-37.1.nflxso.net/dnm/api/v6/X194eJsgWBDE2aQbaNdmCXGUP-Y/AAAABQYHuuRO8hPojbcDF-eNuU_PppZawwQPwA5e2GX9cNq6Cwa4B51pt1ynmeQmThZHZy6oieGg-jRbP0VdfSLO1O1N00eAY_tiez_lpEghlVr0ytaakKICyi7bZOGcfQ.jpg?r=382") serieWitcher.save() serieWitcher.genres.add(genreThriller, genreAction, genreAdventure) serieWitcher.save() serieWitcher.actors.add(actorWitcher) serieWitcher.save() serieBigBang = Serie(name="The Big Bang theory", rating=5.0, seasons=12, classification="TV-14", director=directorMartin, imageUrl="https://www.icmedianet.org/wp/ndog/wp-content/uploads/2014/06/the-big-bang-theory.jpg") serieBigBang.save() serieBigBang.genres.add(genreComedy) serieBigBang.save() serieBigBang.comments.add(commentAndyArrow) serieBigBang.save() serieBigBang.actors.add(actorOwen) serieBigBang.save() serieDrake = Serie(name="Drake & Josh", rating=5.0, seasons=4, classification="TV-Y7", director=directorMartin, imageUrl="https://dam.tvynovelas.com/us/wp-content/uploads/2019/03/drake-josh-show-nuevo-prin.jpg") serieDrake.save() serieDrake.genres.add(genreComedy) serieDrake.save() serieDrake.actors.add(actorDrake) serieDrake.save() serieGreys = Serie(name="Greys Anatomy", rating=5.0, seasons=17, classification="TV-14", director=directorJohn, imageUrl="https://live.mrf.io/statics/i/ps/d2m1kqghccc19k.cloudfront.net/wp-content/uploads/2019/02/01172709/portada3.jpg?width=1200&enable=upscale") serieGreys.save() serieGreys.genres.add(genreDrama, genreRomantic) serieGreys.save() serieGreys.actors.add(actorGreys) serieGreys.save() serieFlash = Serie(name="The Flash", rating=4.0, seasons=7, classification="TV-PG", director=directorLucas, imageUrl="https://www.bolsamania.com/seriesadictos/wp-content/uploads/2018/01/the-flash.jpg") serieFlash.save() serieFlash.genres.add(genreAction, genreAdventure, genreDrama) serieFlash.save() serieFlash.actors.add(actorFlash) serieFlash.save() serieDark = Serie(name="Dark", rating=2.0, seasons=3, classification="TV-MA", director=directorSpielberg, imageUrl="https://cdn.culturagenial.com/es/imagenes/dark-logo-cke.jpg") serieDark.save() serieDark.genres.add(genreThriller, genreHorror) serieDark.save() serieDark.actors.add(actorDark) serieDark.save() serieBreaking = Serie(name="Breaking Bad", rating=3.0, seasons=5, classification="TV-MA", director=directorAnthony, imageUrl="https://www.seriemaniac.com/wp-content/uploads/2013/10/que-significa-Breaking-Bad.jpg") serieBreaking.save() serieBreaking.genres.add(genreAction, genreThriller) serieBreaking.save() serieBreaking.actors.add(actorBreaking) serieBreaking.save() serieTWD = Serie(name="The Walking Dead", rating=4.0, seasons=11, classification="TV-MA", director=directorLucas, imageUrl="https://i2.wp.com/www.moonmagazine.info/wp-content/uploads/2017/10/the_walking_dead_claves_portada_moonmagazine.jpg?fit=1920%2C1080&ssl=1") serieTWD.save() serieTWD.genres.add(genreThriller, genreHorror) serieTWD.save() serieTWD.actors.add(actorTWD) serieTWD.save() serieStranger = Serie(name="Stranger Things", rating=5.0, seasons=4, classification="TV-14", director=directorMartin, imageUrl="https://upload.wikimedia.org/wikipedia/commons/3/38/Stranger_Things_logo.png") serieStranger.save() serieStranger.genres.add(genreHorror, genreThriller) serieStranger.save() serieStranger.actors.add(actorStranger) serieStranger.save() serieGlee = Serie(name="Glee", rating=2.0, seasons=6, classification="TV-PG", director=directorAnthony, imageUrl="https://vanguardia.com.mx/sites/default/files/styles/paragraph_image_large_desktop_1x/public/hkqhr3wqs_qx.jpg") serieGlee.save() serieGlee.genres.add(genreMusical, genreComedy) serieGlee.save() serieGlee.actors.add(actorGlee) serieGlee.save() seriePhineas = Serie(name="Phineas & Ferb", rating=3.0, seasons=4, classification="TV-G", director=directorMartin, imageUrl="https://fanatical.imgix.net/product/original/ed119f6b-7dfa-470a-947c-988b77362fb6.jpg?auto=compress,format&w=400&fit=max") seriePhineas.save() seriePhineas.genres.add(genreMusical) seriePhineas.save() seriePhineas.actors.add(actorPhineas) seriePhineas.save() serieHIMYM = Serie(name="How I Met Your Mother", rating=4.0, seasons=9, classification="TV-14", director=directorLucas, imageUrl="https://e.rpp-noticias.io/normal/2020/02/26/342834_905965.png") serieHIMYM.save() serieHIMYM.genres.add(genreComedy, genreRomantic) serieHIMYM.save() serieHIMYM.actors.add(actorHIMYM) serieHIMYM.save() #Comentarios juegos commentCodAndy = GameComment(text="El mejor shooter", author = userAndy) commentCodAndy.save() commentCodMarco = GameComment(text="Perfecto, muy educativo y entretenido para los pequeñines", author= userMarco) commentCodMarco.save() commentOverwatch = GameComment(text="Me encanta", author=userMarco) commentOverwatch.save() #Juegos game = Videogame(title="Call of Duty: Modern Warfare", classification="M", release_date="2019-10-25", rating=5.0, developer=developerActivision, imageUrl="https://media.redadn.es/imagenes/call-of-duty-modern-warfare-2019-pc-ps4-xbox-one_327982_pn.jpg") game.save() game.genres.add(genreAction, genreShooter) game.save() game.comments.add(commentCodMarco, commentCodAndy) game.save() game.consoles.add(consoleXboxOne, consolePS4, consolePc) game.save() game = Videogame(title="Overwatch", classification="T", release_date="2016-05-24", rating=4.0, developer=developerBlizzard, imageUrl="https://www.educo.org/Educo/media/Imagenes/Blog/%C2%BFDebo-dejar-a-mis-hijos-jugar-con-Overwatch-portada-ok.jpg") game.save() game.genres.add(genreAction, genreShooter) game.save() game.comments.add(commentOverwatch) game.save() game.consoles.add(consoleXboxOne, consolePS4, consolePc) game.save() game = Videogame(title="Super Mario Odyssey", classification="E10+", release_date="2017-10-27", rating=5.0, developer=developerNintendo, imageUrl="https://faros.hsjdbcn.org/sites/default/files/styles/shareimg/public/super-mario-odyssey-nintendo-switch_319061.jpg?itok=oYPL0vzO") game.save() game.genres.add(genrePlatform, genreAdventure) game.save() game.consoles.add(consoleSwitch) game.save() game = Videogame(title="Fifa 20", classification="E", release_date="2019-09-27", rating=5.0, developer=developerEA, imageUrl="https://www.lavanguardia.com/r/GODO/LV/p6/WebSite/2019/09/26/Recortada/img_agarcial_20190926-231319_imagenes_lv_terceros_hipertextual-fifa-20-2019472741-kjMH-U47658119552mdD-992x558@LaVanguardia-Web.jpg") game.save() game.genres.add(genreSport) game.save() game.consoles.add(consoleSwitch, consoleXboxOne, consolePS4) game.save() game = Videogame(title="GTA V", classification="M", release_date="2013-09-17", rating=5.0, developer=developerRockstar, imageUrl="https://as.com/meristation/imagenes/2020/05/15/trucos/1589544811_331717_1589544882_noticia_normal.jpg") game.save() game.genres.add(genreAction, genreShooter) game.save() game.consoles.add(consoleXboxOne, consolePS4, consolePS3, consoleXbox360, consolePc) game.save() game = Videogame(title="Assassins Creed: Odyssey", classification="M", release_date="2018-10-05", rating=2.0, developer=developerUbisoft, imageUrl="https://i.blogs.es/248355/1/450_1000.jpg") game.save() game.genres.add(genreAdventure, genreAction) game.save() game.consoles.add(consoleXboxOne, consolePS4) game.save() game = Videogame(title="Mario Kart 64", classification="E", release_date="1996-12-14", rating=2.0, developer=developerNintendo, imageUrl="https://www.nintenderos.com/wp-content/uploads/2018/10/mario-kart-64.jpg") game.save() game.genres.add(genreSport) game.save() game.consoles.add(console64) game.save() game = Videogame(title="The Last of Us", classification="M", release_date="2013-06-14", rating=4.0, developer=developerNaughty, imageUrl="https://i.pinimg.com/originals/8d/33/b0/8d33b0d0842bf507993021d9ef8b6dd2.jpg") game.save() game.genres.add(genreThriller, genreDrama) game.save() game.consoles.add(consolePS3, consolePS4) game.save() game = Videogame(title="Tomb Raider", classification="M", release_date="2018-09-14", rating=2.0, developer=developerSquareEnix, imageUrl="https://irrompibles.net/irrwp/wp-content/uploads/2018/09/images_2018_informes_shadow-tomb-raider_shadow-of-the-tomb-raider-review.jpg") game.save() game.genres.add(genreThriller, genreAdventure) game.save() game.consoles.add(consolePS4, consoleXboxOne) game.save() game = Videogame(title="Resident Evil 7", classification="M", release_date="2017-01-24", rating=3.0, developer=developerSquareEnix, imageUrl="https://static-abcblogs.abc.es/wp-content/uploads/sites/97/2018/04/resident-evil-7-biohazard-en-espanol-D_NQ_NP_990715-MLA26546800369_122017-F-516x315.jpg") game.save() game.genres.add(genreThriller, genreHorror) game.save() game.consoles.add(consolePS4, consoleXboxOne, consolePc) game.save() game = Videogame(title="Bioshock", classification="M", release_date="2007-08-21", rating=2.0, developer=developerEA, imageUrl="https://as.com/meristation/imagenes/2020/06/02/analisis/1591088622_947400_1591088960_noticia_normal.jpg") game.save() game.genres.add(genreHorror) game.save() game.consoles.add(consolePS4, consoleXboxOne, consoleXbox360, consolePS3) game.save() game = Videogame(title="Doom", classification="M", release_date="2007-08-21", rating=4.0, developer=developerBethesda, imageUrl="https://cdn02.nintendo-europe.com/media/images/10_share_images/games_15/nintendo_switch_4/H2x1_NSwitch_Doom_image1600w.jpg") game.save() game.genres.add(genreHorror, genreAction) game.save() game.consoles.add(consolePS4, consoleXboxOne, consoleSwitch) game.save() game = Videogame(title="NBA 2K20", classification="E", release_date="2019-09-06", rating=4.0, developer=developerEA, imageUrl="https://steamcdn-a.akamaihd.net/steam/apps/1089350/header.jpg?t=1573674198") game.save() game.genres.add(genreSport) game.save() game.consoles.add(consolePS4, consoleXboxOne) game.save() game = Videogame(title="Guitar Hero World Tour", classification="E", release_date="2008-10-06", rating=5.0, developer=developerActivision, imageUrl="https://images3.alphacoders.com/671/thumb-350-671832.jpg") game.save() game.genres.add(genreMusical) game.save() game.consoles.add(consolePS3, consoleXbox360, consolePc) game.save() game = Videogame(title="Rock Band 4", classification="E", release_date="2015-10-06", rating=2.0, developer=developerUbisoft, imageUrl="https://applauss.com/wp-content/uploads/2015/09/Canciones-Rock-Band-4-770x511.jpg") game.save() game.genres.add(genreMusical) game.save() game.consoles.add(consolePS4, consoleXboxOne) game.save() game = Videogame(title="Just Dance 2019", classification="E", release_date="2018-10-23", rating=3.0, developer=developerUbisoft, imageUrl="https://ubistatic19-a.akamaihd.net/ubicomstatic/es-mx/global/search-thumbnail/jd19-ubicom_search_thumbnail-750x422_325114.jpg") game.save() game.genres.add(genreMusical) game.save() game.consoles.add(consolePS4, consoleXboxOne, consoleXbox360, consoleSwitch) game.save() game = Videogame(title="Super Mario Galaxy", classification="E", release_date="2007-11-01", rating=3.0, developer=developerNintendo, imageUrl="https://cdn.startselect.com/production/products/images/cdabd/31557/1338811742-360x360.jpg") game.save() game.genres.add(genrePlatform) game.save() game.consoles.add(consoleSwitch) game.save() game = Videogame(title="Super Mario Sunshine", classification="E", release_date="2002-08-26", rating=2.0, developer=developerNintendo, imageUrl="https://f3.trucoteca.com/fotos/4307/super-mario-sunshine-3.png") game.save() game.genres.add(genrePlatform) game.save() game.consoles.add(consoleSwitch) game.save() data= { 'Status': 'Ok', 'Data': 'Data imported' } return JsonResponse(data)