2017-08-16 20:00:41 +00:00
|
|
|
from django.db import models
|
|
|
|
|
|
|
|
|
|
|
|
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
|
2017-08-16 20:07:40 +00:00
|
|
|
|
2017-08-17 19:09:55 +00:00
|
|
|
class Meta:
|
|
|
|
ordering = ('name',)
|
|
|
|
|
2017-08-16 20:07:40 +00:00
|
|
|
|
|
|
|
class Game(models.Model):
|
|
|
|
"""
|
|
|
|
A video game you will use on a specific Console.
|
|
|
|
"""
|
|
|
|
name = models.CharField(max_length=254)
|
|
|
|
console = models.ForeignKey('games.Console')
|
|
|
|
|
|
|
|
def __str__(self):
|
|
|
|
return '%s' % self.name
|