Browse Source

pass django tests

master
Daniel Martinez 1 year ago
parent
commit
8596cccfbe
  1. 8
      managemedia/models/books.py
  2. 12
      managemedia/models/common.py
  3. 10
      managemedia/models/movies.py
  4. 6
      managemedia/models/tv.py
  5. 10
      managemedia/models/vgames.py

8
managemedia/models/books.py

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

12
managemedia/models/common.py

@ -15,21 +15,21 @@ class MediaTypes(models.Model):
class CommonMediaFields(models.Model):
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)
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)
original_language = models.CharField('Original Language', max_length=256, blank=True)
class Meta:
abstract = True
### VideoFields is for movies and tv shows
class VideoFields(CommonMediaFields):
tmdb_id = models.CharField('TheMovieDB ID', blank=True)
imdb_id = models.CharField('IMDB ID', blank=True)
tmdb_id = models.CharField('TheMovieDB ID', blank=True, max_length=256)
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)
tmdb_rating = models.DecimalField('TheMovieDB rating', max_digits=5, blank=True, decimal_places=3)
class Meta:
@ -37,8 +37,8 @@ class VideoFields(CommonMediaFields):
class Genres(models.Model):
media = models.ForeignKey('MediaTypes', on_delete=models.CASCADE)
genre = models.CharField('Genre')
genre = models.CharField('Genre', max_length=256)
class MediaStatus(models.Model):
media = models.ForeignKey('MediaTypes', on_delete=models.CASCADE)
status = models.CharField('Status')
status = models.CharField('Status', max_length=256)

10
managemedia/models/movies.py

@ -1,18 +1,18 @@
from django.db import models
from django.core import validators
from .common import VideoFields
from .common import VideoFields,MediaTypes
class Movies(VideoFields):
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)
rt_rating = models.PositiveIntegerField('Rotten Tomatoes Rating', blank=True)
am_rating = models.DecimalField('AllMovie Rating', max_digits=3, decimal_places=1, blank=True)
class MovieAltTitles(models.Model):
film = models.ForeignKey('Movies', on_delete=models.CASCADE)
title = models.CharField('Title')
country = models.CharField('Country')
title_type = models.CharField('Type', blank=True)
title = models.CharField('Title', max_length=256)
country = models.CharField('Country', max_length=256)
title_type = models.CharField('Type', blank=True, max_length=256)
class MovieGenres(models.Model):
movie = models.ForeignKey('Movies', on_delete=models.CASCADE)

6
managemedia/models/tv.py

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

10
managemedia/models/vgames.py

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

Loading…
Cancel
Save