further model building

master
Daniel Martinez 2020-06-08 20:25:22 -04:00
parent cffb873298
commit b016a4c649
5 changed files with 73 additions and 22 deletions

View File

@ -0,0 +1,16 @@
from django.db import models
class Book(CommonMediaFields)
author = models.ForeignKey('Author')
series = models.ForeignKey('Series', blank=True)
series_entry = models.BooleanField('Series Entry', blank=True)
is_comic = models.BooleanField('Comic')
is_manga = models.BooleanField('Manga')
class Author(models.Model)
name = models.CharFields('Author', unique=True)
sort_name = models.CharFields('Author sort name', blank=True)
class Series(models.Model)
name = models.CharFields('Series', unique=True)
total_entries = models.PositiveIntegerField('Total Entries', blank=True)

View File

@ -10,25 +10,27 @@ class MediaTypes(models.Model):
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')
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')
original_language = models.CharField('Original Language', blank=True)
class Meta:
abstract = True
### VideoFields is for movies and tv shows
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)
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

View File

@ -1,17 +1,17 @@
from django.db import models
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)
original_title = models.CharField('Original Title', maxlength=256, blank=True)
tagline = models.CharField('Tagline', blank=True)
runtime = models.PositiveIntegerField('Total Runtime', blank=True)
rt_rating = models.PositiveIntegerField('Rotten Tomatoes Rating', max_value=100, blank=True)
am_rating = models.DecimalField('AllMovie Rating', max_digits=3, decimal_places=1, blank=True)
class FilmAltTitles(models.Model):
film = models.ForeignKey('Film', on_delete=models.CASCADE)
title = models.CharField('Title')
country = models.CharField('Country')
type = models.CharField('Type')
title_type = models.CharField('Type', blank=True)
class FilmGenres(models.Model):
film = models.ForeignKey('Film', on_delete=models.CASCADE)

View File

@ -0,0 +1,16 @@
from django.db import models
class Television(VideoFields)
episodes = models.PositiveIntegerField('Number of Episodes', min_value=1, blank=True)
seasons = models.PositiveIntegerField('Number of Seasons', min_value=1, blank=True)
first_aired = models.DateField('First Aired Date', blank=True)
last_aired = models.DateField('Last Aired Date', blank=True)
networks = models.ForeignKey('Networks', blank=True)
status = models.CharField('Status', blank=True)
class Networks(models.Model)
name = models.CharField('Network')
class ShowtoNetworks(models.Model)
show = models.ForeignKey('Television')
network = models.ForeignKey('Networks')

View File

@ -1,9 +1,26 @@
from django.db import models
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')
cover = models.ImageField('Cover Image', blank=True)
players = models.PositiveIntegerField('Players', blank=True)
coop = models.BooleanField('Co-Op', blank=True)
mc_rating = models.PositiveIntegerFrield('MetaCritic Rating', max_value=100, blank=True)
class Publishers(models.Model)
name = models.CharField('Publisher Name')
class Developers(models.Model)
name = models.CharField('Developer Name')
class Platforms(models.Model)
name = models.CharField('Game System')
class PublisherMap(models.Model)
publisher = models.ForeignKey('Publishers')
game = models.ForeignKey('VGames')
class DeveloperMap(models.Model)
developer = models.ForeignKey('Developers')
game = models.ForeignKey('VGames')