keymedia/managemedia/models/common.py

44 lines
1.6 KiB
Python
Raw Normal View History

2020-06-08 19:21:18 -04:00
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')
2020-06-08 20:25:22 -04:00
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)
2020-06-08 19:21:18 -04:00
creation_date = models.DateTimeField('Added Date', auto_now_add=True)
updated_date = models.DateTimeField('Updated Date', auto_now=True)
2020-06-08 20:25:22 -04:00
original_language = models.CharField('Original Language', blank=True)
2020-06-08 19:21:18 -04:00
class Meta:
abstract = True
2020-06-08 20:25:22 -04:00
### VideoFields is for movies and tv shows
2020-06-08 19:21:18 -04:00
class VideoFields(CommonFields):
2020-06-08 20:25:22 -04:00
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)
2020-06-08 19:21:18 -04:00
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')