keymedia/managemedia/models/models.py

61 lines
2.3 KiB
Python

from django.db import models
class MediaTypes(models.Model):
name = models.CharField('Title')
class CommonMediaFields(models.Model):
name = models.CharField('Title', maxlength=256)
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')
class Film(VideoFields):
original_title = models.CharField('Original Title', maxlength=256)
tagline = modelx.CharField('Tagline')
runtime = models.PositiveIntegerField('Total Runtime')
cover = models.ImageField('Cover Image')
backdrop = models.ImageField('Backdrop Image')
rt_rating = models.PositiveIntegerField('Rotten Tomatoes Rating', max_value=100)
am_rating = models.DecimalField('AllMovie Rating', max_digits=3, decimal_places=1)
class FilmAltTitles(models.Model):
film = models.ForeignKey('Film', on_delete=models.CASCADE)
title = models.CharField('Title')
country = models.CharField('Country')
type = models.CharField('Type')
class FilmGenres(models.Model):
film = models.ForeignKey('Film', on_delete=models.CASCADE)
genre = models.ForeignKey('Genres', on_delete=models.CASCADE)
class VGames(CommonMediaFields)
tgdb_id = models.PositiveIntegerField('TheGamesDB ID')
platform = models.ForeignKey('Platform')
developer = models.CharField('Developers')
publisher = models.CharField('Publishers')
cover = models.ImageField('Cover Image')
players = models.PositiveIntegerField('Players')
coop = models.BooleanField('Co-Op')