keymedia/managemedia/models/common.py

42 lines
1.4 KiB
Python

from django.db import models
class MediaTypes(models.Model):
MEDIA_TYPES = [
('vg', 'Video Games'),
('mo', 'Movies'),
('tv', 'TV Shows'),
('bo', 'Books'),
]
media_type = models.CharField(
max_length=2,
choices=MEDIA_TYPES,
default='mo',
)
class CommonMediaFields(models.Model):
name = models.CharField('Title', maxlength=256)
media_type = models.ForeignKey('MediaType')
summary = models.TextField('Summary')
release_date = models.DateField('Release Date')
creation_date = models.DateTimeField('Added Date', auto_now_add=True)
updated_date = models.DateTimeField('Updated Date', auto_now=True)
original_language = models.CharField('Original Language')
class Meta:
abstract = True
class VideoFields(CommonFields):
tmdb_id = models.PositiveIntegerField('TheMovieDB ID')
imdb_id = models.PositiveIntegerField('IMDB ID')
tmdb_rating = models.PositiveIntegerField('TheMovieDB rating', max_value=100)
mc_rating = models.PositiveIntegerFrield('MetaCritic Rating', max_value=100)
class Meta:
abstract = True
class Genres(models.Model):
media = models.ForeignKey('MediaTypes')
genre = models.CharFields('Genre')
class MediaStatus(models.Model):
media = models.ForeignKey('MediaTypes')
status = models.CharFields('Status')