pass django tests

master
Daniel Martinez 2020-06-12 17:49:58 -04:00
parent 23134aa0df
commit 8596cccfbe
5 changed files with 23 additions and 23 deletions

View File

@ -1,5 +1,5 @@
from django.db import models from django.db import models
from .common import CommonMediaFields from .common import CommonMediaFields,MediaTypes
class Book(CommonMediaFields): class Book(CommonMediaFields):
author = models.ForeignKey('Author', on_delete=models.CASCADE) author = models.ForeignKey('Author', on_delete=models.CASCADE)
series = models.ForeignKey('Series', on_delete=models.CASCADE, blank=True) series = models.ForeignKey('Series', on_delete=models.CASCADE, blank=True)
@ -8,9 +8,9 @@ class Book(CommonMediaFields):
is_manga = models.BooleanField('Manga') is_manga = models.BooleanField('Manga')
class Author(models.Model): class Author(models.Model):
name = models.CharField('Author', unique=True) name = models.CharField('Author', max_length=256, unique=True)
sort_name = models.CharField('Author sort name', blank=True) sort_name = models.CharField('Author sort name', max_length=256, blank=True)
class Series(models.Model): class Series(models.Model):
name = models.CharField('Series', unique=True) name = models.CharField('Series', unique=True, max_length=256)
total_entries = models.PositiveIntegerField('Total Entries', blank=True) total_entries = models.PositiveIntegerField('Total Entries', blank=True)

View File

@ -15,21 +15,21 @@ class MediaTypes(models.Model):
class CommonMediaFields(models.Model): class CommonMediaFields(models.Model):
name = models.CharField('Title', max_length=256) name = models.CharField('Title', max_length=256)
media_type = models.ForeignKey('MediaType', on_delete=models.CASCADE) media_type = models.ForeignKey('MediaTypes', on_delete=models.CASCADE)
summary = models.TextField('Summary', blank=True) summary = models.TextField('Summary', blank=True)
cover = models.ImageField('Cover Image', blank=True) cover = models.ImageField('Cover Image', blank=True)
backdrop = models.ImageField('Backdrop Image', blank=True) backdrop = models.ImageField('Backdrop Image', blank=True)
release_date = models.DateField('Release Date', blank=True) release_date = models.DateField('Release Date', blank=True)
creation_date = models.DateTimeField('Added Date', auto_now_add=True) creation_date = models.DateTimeField('Added Date', auto_now_add=True)
updated_date = models.DateTimeField('Updated Date', auto_now=True) updated_date = models.DateTimeField('Updated Date', auto_now=True)
original_language = models.CharField('Original Language', blank=True) original_language = models.CharField('Original Language', max_length=256, blank=True)
class Meta: class Meta:
abstract = True abstract = True
### VideoFields is for movies and tv shows ### VideoFields is for movies and tv shows
class VideoFields(CommonMediaFields): class VideoFields(CommonMediaFields):
tmdb_id = models.CharField('TheMovieDB ID', blank=True) tmdb_id = models.CharField('TheMovieDB ID', blank=True, max_length=256)
imdb_id = models.CharField('IMDB ID', blank=True) imdb_id = models.CharField('IMDB ID', blank=True, max_length=256)
imdb_rating = models.DecimalField('IMDB rating', max_digits=5, blank=True, decimal_places=3) imdb_rating = models.DecimalField('IMDB rating', max_digits=5, blank=True, decimal_places=3)
tmdb_rating = models.DecimalField('TheMovieDB rating', max_digits=5, blank=True, decimal_places=3) tmdb_rating = models.DecimalField('TheMovieDB rating', max_digits=5, blank=True, decimal_places=3)
class Meta: class Meta:
@ -37,8 +37,8 @@ class VideoFields(CommonMediaFields):
class Genres(models.Model): class Genres(models.Model):
media = models.ForeignKey('MediaTypes', on_delete=models.CASCADE) media = models.ForeignKey('MediaTypes', on_delete=models.CASCADE)
genre = models.CharField('Genre') genre = models.CharField('Genre', max_length=256)
class MediaStatus(models.Model): class MediaStatus(models.Model):
media = models.ForeignKey('MediaTypes', on_delete=models.CASCADE) media = models.ForeignKey('MediaTypes', on_delete=models.CASCADE)
status = models.CharField('Status') status = models.CharField('Status', max_length=256)

View File

@ -1,18 +1,18 @@
from django.db import models from django.db import models
from django.core import validators from django.core import validators
from .common import VideoFields from .common import VideoFields,MediaTypes
class Movies(VideoFields): class Movies(VideoFields):
original_title = models.CharField('Original Title', max_length=256, blank=True) original_title = models.CharField('Original Title', max_length=256, blank=True)
tagline = models.CharField('Tagline', blank=True) tagline = models.CharField('Tagline', blank=True, max_length=256)
runtime = models.PositiveIntegerField('Total Runtime', blank=True) runtime = models.PositiveIntegerField('Total Runtime', blank=True)
rt_rating = models.PositiveIntegerField('Rotten Tomatoes Rating', blank=True) rt_rating = models.PositiveIntegerField('Rotten Tomatoes Rating', blank=True)
am_rating = models.DecimalField('AllMovie Rating', max_digits=3, decimal_places=1, blank=True) am_rating = models.DecimalField('AllMovie Rating', max_digits=3, decimal_places=1, blank=True)
class MovieAltTitles(models.Model): class MovieAltTitles(models.Model):
film = models.ForeignKey('Movies', on_delete=models.CASCADE) film = models.ForeignKey('Movies', on_delete=models.CASCADE)
title = models.CharField('Title') title = models.CharField('Title', max_length=256)
country = models.CharField('Country') country = models.CharField('Country', max_length=256)
title_type = models.CharField('Type', blank=True) title_type = models.CharField('Type', blank=True, max_length=256)
class MovieGenres(models.Model): class MovieGenres(models.Model):
movie = models.ForeignKey('Movies', on_delete=models.CASCADE) movie = models.ForeignKey('Movies', on_delete=models.CASCADE)

View File

@ -1,15 +1,15 @@
from django.db import models from django.db import models
from .common import VideoFields from .common import VideoFields,MediaTypes
class Television(VideoFields): class Television(VideoFields):
episodes = models.PositiveIntegerField('Number of Episodes', blank=True) episodes = models.PositiveIntegerField('Number of Episodes', blank=True)
seasons = models.PositiveIntegerField('Number of Seasons', blank=True) seasons = models.PositiveIntegerField('Number of Seasons', blank=True)
first_aired = models.DateField('First Aired Date', blank=True) first_aired = models.DateField('First Aired Date', blank=True)
last_aired = models.DateField('Last Aired Date', blank=True) last_aired = models.DateField('Last Aired Date', blank=True)
networks = models.ForeignKey('Networks', on_delete=models.CASCADE, blank=True) networks = models.ForeignKey('Networks', on_delete=models.CASCADE, blank=True)
status = models.CharField('Status', blank=True) status = models.CharField('Status', blank=True, max_length=256)
class Networks(models.Model): class Networks(models.Model):
name = models.CharField('Network') name = models.CharField('Network', max_length=256)
class ShowtoNetworks(models.Model): class ShowtoNetworks(models.Model):
show = models.ForeignKey('Television', on_delete=models.CASCADE) show = models.ForeignKey('Television', on_delete=models.CASCADE)

View File

@ -1,5 +1,5 @@
from django.db import models from django.db import models
from .common import CommonMediaFields from .common import CommonMediaFields,MediaTypes
class VGames(CommonMediaFields): class VGames(CommonMediaFields):
tgdb_id = models.PositiveIntegerField('TheGamesDB ID') tgdb_id = models.PositiveIntegerField('TheGamesDB ID')
platform = models.ForeignKey('Platform', on_delete=models.CASCADE) platform = models.ForeignKey('Platform', on_delete=models.CASCADE)
@ -9,13 +9,13 @@ class VGames(CommonMediaFields):
mc_rating = models.PositiveIntegerField('MetaCritic Rating', blank=True) mc_rating = models.PositiveIntegerField('MetaCritic Rating', blank=True)
class Publishers(models.Model): class Publishers(models.Model):
name = models.CharField('Publisher Name') name = models.CharField('Publisher Name', max_length=256)
class Developers(models.Model): class Developers(models.Model):
name = models.CharField('Developer Name') name = models.CharField('Developer Name', max_length=256)
class Platforms(models.Model): class Platform(models.Model):
name = models.CharField('Game System') name = models.CharField('Game System', max_length=256)
class PublisherMap(models.Model): class PublisherMap(models.Model):
publisher = models.ForeignKey('Publishers', on_delete=models.CASCADE) publisher = models.ForeignKey('Publishers', on_delete=models.CASCADE)