week4/16-debugging
2023-09-24 17:16:25 -04:00
..
2023-09-24 17:16:25 -04:00
2023-09-24 17:16:25 -04:00

Debugging Challenge

So you and your buddies made a sweet MMORPG. You don't have any players yet, and you wanted to test the database, so you hired someone to write code to seed it.

It should be all done - you'll just have to make the migrations, migrate the DB, and run the seed file successfully. But should is a bad word in programming. Turns out, this guy had no idea how to do it and his code is a mess.

To run the seed, you should just have to instantiate the class once like so:

SeedDatabase(players = 50, heroes = 150, teams = 20)

It takes three keyword arguments - number of players to create, number of heroes to create, number of teams to create. In the database, Players have many Heroes. Heroes have many Teams and Teams have many Heroes.

Goal

Using the error statements and your knowledge of Python and Django, go through and debug the code. When you are done, go in the Django shell and test your relations. Read through the docs from Django on Many to Many and One to Many relationships if you haven't already.