Skip to content

Commit

Permalink
add game release type
Browse files Browse the repository at this point in the history
  • Loading branch information
Your Name authored and alphatownsman committed Jul 27, 2024
1 parent b4bdc58 commit 532439b
Show file tree
Hide file tree
Showing 5 changed files with 386 additions and 152 deletions.
23 changes: 23 additions & 0 deletions catalog/game/models.py
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
from datetime import date

from django.db import models
from django.template.defaultfilters import default
from django.utils.translation import gettext_lazy as _

from catalog.common import (
Expand All @@ -17,11 +18,25 @@
)


class GameReleaseType(models.TextChoices):
# Unspecified = "", _("Unspecified") # type:ignore[reportCallIssue]
GAME = "game", _("Main Game") # type:ignore[reportCallIssue]
EXPANSION = "expansion", _("Expansion") # type:ignore[reportCallIssue]
DLC = "dlc", _("Downloadable Content") # type:ignore[reportCallIssue]
MOD = "mod", _("Mod") # type:ignore[reportCallIssue]
BUNDLE = "bundle", _("Bundle") # type:ignore[reportCallIssue]
REMASTER = "remaster", _("Remaster") # type:ignore[reportCallIssue]
REMAKE = "remake", _("Remake") # type:ignore[reportCallIssue]
SPECIAL = "special", _("Special Edition") # type:ignore[reportCallIssue]
OTHER = "other", _("Other") # type:ignore[reportCallIssue]


class GameInSchema(ItemInSchema):
genre: list[str]
developer: list[str]
publisher: list[str]
platform: list[str]
release_type: str | None = None
release_date: date | None = None
official_site: str | None = None

Expand Down Expand Up @@ -49,6 +64,7 @@ class Game(Item):
"publisher",
"release_year",
"release_date",
"release_type",
"genre",
"platform",
"official_site",
Expand Down Expand Up @@ -108,6 +124,13 @@ class Game(Item):
help_text=_("YYYY-MM-DD"),
)

release_type = jsondata.CharField(
verbose_name=_("release type"),
max_length=100,
blank=True,
choices=GameReleaseType.choices,
)

genre = jsondata.ArrayField(
verbose_name=_("genre"),
base_field=models.CharField(blank=True, default="", max_length=200),
Expand Down
5 changes: 5 additions & 0 deletions catalog/templates/game.html
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,11 @@
<div class="tldr-2" _="on click toggle .tldr-2 on me">
{% include '_people.html' with people=item.additional_title _role='' max=99 %}
</div>
<div>
{% if item.release_type %}
{% trans 'release type' %}: {{ item.get_release_type_display }}
{% endif %}
</div>
<div>
{% if item.release_date %}
{% trans 'release date' %}: {{ item.release_date }}
Expand Down
Loading

0 comments on commit 532439b

Please sign in to comment.