openbackloggery/collection/games/models.py

52 lines
1.3 KiB
Python
Raw Normal View History

from core.models import Collection, Item, Timeline as BaseTimeline
2017-08-16 20:00:41 +00:00
from django.db import models
from django.utils.translation import ugettext as _
2017-08-16 20:00:41 +00:00
class Console(Collection):
2017-08-16 20:00:41 +00:00
"""
All console, system or box that can be used to play video games.
"""
def __str__(self):
return '%s' % self.name
class Game(Item):
"""
A video game you will use on a specific Console.
"""
# class config
TARGET_MODEL = 'games.Console'
TARGET_VERBOSE_NAME = _('console')
RELATED_TARGET_NAME = 'games'
# Status choices
BEATEN = 'beaten'
COMPLETED = 'completed'
EXCLUDED = 'excluded'
MASTERED = 'mastered'
UNFINISHED = 'unfinished'
STATUS_CHOICES = (
(BEATEN, _('Beaten')),
(COMPLETED, _('Completed')),
(EXCLUDED, _('Excluded')),
(MASTERED, _('Mastered')),
(UNFINISHED, _('Unfinished')),
)
DEFAULT_CHOICE = UNFINISHED
# others
playing = models.BooleanField(default=False)
unplayed = models.BooleanField(default=False)
wish = models.BooleanField(default=False)
class Meta:
ordering = ('-playing', 'name')
class Timeline(BaseTimeline):
TARGET_MODEL = 'games.Game'
STATUS_CHOICES = Game.STATUS_CHOICES
DEFAULT_CHOICE = Item.DEFAULT_CHOICE