Closed ptlin25 closed 8 months ago
Is our final decision to track designers, artists, and publisher(s)? If yes, what is the best way to model it? We could use a ManyToManyField, but that would require creating a model for "people".
Created branch game-management/update-game-model
for this task
Added most of the attributes (excluding designers, artists, and publishers) to the Game model. Once we decide how to model the designers, artists, and publishers, those fields will be added and a migration will be made.
When running python3 manage.py makemigrations
I got this message:
It is impossible to add a non-nullable field 'BGG_id' to game without specifying a default. This is because the database needs something to populate existing rows. Please select a fix: 1) Provide a one-off default now (will be set on all existing rows with a null value for this column) 2) Quit and manually define a default value in models.py.
In response to this, I set the default value on bgg_id to null with the mindset that not all the games will be sourced from BGG. So the bgg_id attribute id now looks like this BGG_id = models.PositiveIntegerField(null=True)
. I did the same thing for the following attributes that raised a similar issue:
complexity
rules
min_playtime
max_playtime
year_published
image
I'm not sure why we have to set a default value though.
I have also made a People
model so it will make linking artists, publishers, and designers to games easier.
The error occurs because you have entities in the database that do not have the attributes you just created, so Django needs to know what to do with the Games already in the database. Also, your commit does not have the People
model added.
It could be beneficial to create a separate non-person entity for Publishers, which would make adding Publisher information pages easier in the future. These could provide useful details such as the publisher's founding date, location, game portfolio, and website link.
This issue has been completed via #153. We have added more attributes to the Game model and created the relevant models. @ptlin25 created the branch and added attribute fields for year published, rules, expected playtime, minimum and maximum playtime, and BGG id. @danielngira created an initial migration for the basic attributes and created a Person model @frowenz finished the attributes and added new models for Publisher, Mechanic, and Category
Issue Score: Excellent
Comments: Phenomenal job y'all!
Very happy to see y'all use markdown formatting, actually using the updates in the issue to communicate with one another, as well as being verbose in your comments.
Great work and keep going!
We need to update the Game model in Django (in
chigames/games/models.py
) with the required attributes specified in #39. This will also necessitate updating the Game Detail View, Update View, and Create View to show these attributes. A provisional list of attributes to be added are rules, expected playtime, minimum playtime, maximum playtime, designers, artists, publisher, year published, game thumbnail/image, complexity, and BGG id.