uchicago-cs / chigame

BSD 3-Clause "New" or "Revised" License
2 stars 0 forks source link

Complete the game model in django to have the updated attributes #92

Closed ptlin25 closed 8 months ago

ptlin25 commented 8 months ago

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.

ptlin25 commented 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".

ptlin25 commented 8 months ago

Created branch game-management/update-game-model for this task

ptlin25 commented 8 months ago

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.

danielngira commented 8 months ago

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:

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.

ptlin25 commented 8 months ago

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.

frowenz commented 8 months ago

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.

frowenz commented 8 months ago

I have made a bunch of changes. Here are the major ones:

  1. New publisher model
  2. Mechanic and category models
  3. Added a no picture available png

A list of categories and mechanics can be found here and here.

ptlin25 commented 8 months ago

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

majorsylvie commented 7 months ago

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!