2017-08-22 19:02:43 +00:00
|
|
|
from core.models import Collection, Item, Timeline as BaseTimeline
|
2017-08-16 20:00:41 +00:00
|
|
|
from django.db import models
|
2017-08-17 20:42:48 +00:00
|
|
|
from django.utils.translation import ugettext as _
|
2017-08-16 20:00:41 +00:00
|
|
|
|
|
|
|
|
2017-09-16 15:42:04 +00:00
|
|
|
class Platform(Collection):
|
2017-08-16 20:00:41 +00:00
|
|
|
"""
|
2017-09-16 15:42:04 +00:00
|
|
|
All platform, system or box that can be used to play video games.
|
2017-08-16 20:00:41 +00:00
|
|
|
"""
|
|
|
|
def __str__(self):
|
|
|
|
return '%s' % self.name
|
2017-08-16 20:07:40 +00:00
|
|
|
|
2017-08-24 20:36:55 +00:00
|
|
|
class Meta:
|
2017-08-25 12:02:10 +00:00
|
|
|
ordering = ('name',)
|
2017-09-16 15:42:04 +00:00
|
|
|
verbose_name = _('platform')
|
|
|
|
verbose_name_plural = _('platforms')
|
2017-08-24 20:36:55 +00:00
|
|
|
|
2017-08-16 20:07:40 +00:00
|
|
|
|
2017-09-04 21:42:57 +00:00
|
|
|
# Redefine help_text (for documentation, API, etc.)
|
2017-09-16 15:42:04 +00:00
|
|
|
Platform._meta.get_field('name').help_text = _('Most used platform name.')
|
2017-09-04 21:42:57 +00:00
|
|
|
|
|
|
|
|
2017-08-22 19:02:43 +00:00
|
|
|
class Game(Item):
|
2017-08-16 20:07:40 +00:00
|
|
|
"""
|
2017-09-16 15:42:04 +00:00
|
|
|
A video game you will use on a specific Platform.
|
2017-08-16 20:07:40 +00:00
|
|
|
"""
|
2017-08-22 19:02:43 +00:00
|
|
|
# class config
|
2017-09-16 15:42:04 +00:00
|
|
|
TARGET_MODEL = 'games.Platform'
|
|
|
|
TARGET_VERBOSE_NAME = _('platform')
|
2017-08-22 19:02:43 +00:00
|
|
|
RELATED_TARGET_NAME = 'games'
|
|
|
|
|
2017-08-17 20:42:48 +00:00
|
|
|
# Status choices
|
2017-08-22 19:02:43 +00:00
|
|
|
BEATEN = 'beaten'
|
|
|
|
COMPLETED = 'completed'
|
|
|
|
EXCLUDED = 'excluded'
|
|
|
|
MASTERED = 'mastered'
|
|
|
|
UNFINISHED = 'unfinished'
|
2017-08-17 20:42:48 +00:00
|
|
|
|
|
|
|
STATUS_CHOICES = (
|
|
|
|
(BEATEN, _('Beaten')),
|
|
|
|
(COMPLETED, _('Completed')),
|
|
|
|
(EXCLUDED, _('Excluded')),
|
|
|
|
(MASTERED, _('Mastered')),
|
2017-08-22 19:02:43 +00:00
|
|
|
(UNFINISHED, _('Unfinished')),
|
2017-08-17 20:42:48 +00:00
|
|
|
)
|
2017-08-22 19:02:43 +00:00
|
|
|
DEFAULT_CHOICE = UNFINISHED
|
2017-08-17 20:42:48 +00:00
|
|
|
|
2017-08-25 22:23:56 +00:00
|
|
|
# progression
|
|
|
|
note = models.CharField(
|
|
|
|
max_length=150,
|
|
|
|
null=True,
|
2017-08-31 12:15:16 +00:00
|
|
|
blank=True,
|
2017-08-25 22:23:56 +00:00
|
|
|
verbose_name=_('Progress note'),
|
|
|
|
help_text=_('Short note displayed to your followers.'))
|
|
|
|
|
2017-08-17 20:42:48 +00:00
|
|
|
# others
|
2017-08-24 18:43:58 +00:00
|
|
|
playing = models.BooleanField(
|
|
|
|
default=False,
|
2017-08-24 20:36:55 +00:00
|
|
|
verbose_name=_('playing?'),
|
2017-08-24 18:43:58 +00:00
|
|
|
help_text=_('You\'re currently playing this game.'))
|
|
|
|
unplayed = models.BooleanField(
|
|
|
|
default=False,
|
2017-08-24 20:36:55 +00:00
|
|
|
verbose_name=_('unplayed?'),
|
2017-08-24 18:43:58 +00:00
|
|
|
help_text=_('You never played this game.'))
|
|
|
|
wish = models.BooleanField(
|
|
|
|
default=False,
|
2017-08-24 20:36:55 +00:00
|
|
|
verbose_name=_('wish?'),
|
2017-08-24 18:43:58 +00:00
|
|
|
help_text=_('You\'re waiting X-mas father offers you this game.'))
|
2017-08-16 20:07:40 +00:00
|
|
|
|
2017-08-17 20:42:48 +00:00
|
|
|
class Meta:
|
|
|
|
ordering = ('-playing', 'name')
|
2017-08-24 20:36:55 +00:00
|
|
|
verbose_name = _('game')
|
|
|
|
verbose_name_plural = _('games')
|
2017-08-22 19:02:43 +00:00
|
|
|
|
|
|
|
|
2017-09-16 22:04:26 +00:00
|
|
|
# Redefine help_text (for documentation, API, etc.)
|
|
|
|
Game._meta.get_field('name').help_text = _('Game title')
|
|
|
|
Game._meta.get_field('collection').help_text = _('Game running platform')
|
|
|
|
Game._meta.get_field('status').help_text = _('Game progression')
|
|
|
|
|
|
|
|
|
2017-08-22 19:02:43 +00:00
|
|
|
class Timeline(BaseTimeline):
|
|
|
|
TARGET_MODEL = 'games.Game'
|
2017-08-24 20:36:55 +00:00
|
|
|
TARGET_VERBOSE_NAME = 'game'
|
2017-08-22 19:02:43 +00:00
|
|
|
STATUS_CHOICES = Game.STATUS_CHOICES
|
|
|
|
DEFAULT_CHOICE = Item.DEFAULT_CHOICE
|
2017-08-24 20:36:55 +00:00
|
|
|
|
|
|
|
class Meta:
|
2017-08-25 12:02:10 +00:00
|
|
|
ordering = ('-date',)
|
2017-08-24 20:36:55 +00:00
|
|
|
verbose_name = _('Timeline')
|
|
|
|
verbose_name_plural = _('Timelines')
|
2017-09-16 22:04:26 +00:00
|
|
|
|
|
|
|
|
|
|
|
# Redefine help_text (for documentation, API, etc.)
|
|
|
|
Timeline._meta.get_field('date').help_text = _('Status change date')
|
|
|
|
Timeline._meta.get_field('item').help_text = _('Which game?')
|
|
|
|
Timeline._meta.get_field('status').help_text = _(
|
|
|
|
'New status for this game at the given date')
|