from django.db import models from django.utils.translation import ugettext as _ class Console(models.Model): """ All console, system or box that can be used to play video games. """ name = models.CharField(max_length=254) def __str__(self): return '%s' % self.name class Meta: ordering = ('name',) class Game(models.Model): """ A video game you will use on a specific Console. """ # Status choices BEATEN = 0 COMPLETED = 1 EXCLUDED = 2 MASTERED = 3 UNFINISHED = 4 STATUS_CHOICES = ( (UNFINISHED, _('Unfinished')), (BEATEN, _('Beaten')), (COMPLETED, _('Completed')), (EXCLUDED, _('Excluded')), (MASTERED, _('Mastered')), ) # required name = models.CharField(max_length=254) console = models.ForeignKey('games.Console') status = models.IntegerField( choices=STATUS_CHOICES, default=UNFINISHED) # others playing = models.BooleanField(default=False) unplayed = models.BooleanField(default=False) wish = models.BooleanField(default=False) def __str__(self): return '%s' % self.name class Meta: ordering = ('-playing', 'name')