keymedia/managemedia/models/common.py

44 lines
1.6 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,
)
class CommonMediaFields(models.Model):
name = models.CharField('Title', maxlength=256)
media_type = models.ForeignKey('MediaType')
summary = models.TextField('Summary', blank=True)
cover = models.ImageField('Cover Image', blank=True)
backdrop = models.ImageField('Backdrop Image', blank=True)
release_date = models.DateField('Release Date', blank=True)
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', blank=True)
class Meta:
abstract = True
### VideoFields is for movies and tv shows
class VideoFields(CommonMediaFields):
tmdb_id = models.PositiveIntegerField('TheMovieDB ID', blank=True)
imdb_id = models.PositiveIntegerField('IMDB ID', blank=True)
tmdb_rating = models.PositiveIntegerField('TheMovieDB rating', max_value=100, blank=True)
mc_rating = models.PositiveIntegerFrield('MetaCritic Rating', max_value=100, blank=True)
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')