fixed syntax issues in models

master
Daniel Martinez 2020-06-12 15:43:36 -04:00
parent 4bf62d4645
commit 23134aa0df
8 changed files with 34 additions and 32 deletions

View File

@ -31,7 +31,7 @@ ALLOWED_HOSTS = []
# Application definition
INSTALLED_APPS = [
'managemedia.apps.AppConfig',
'managemedia.apps.ManagemediaConfig',
'django.contrib.admin',
'django.contrib.auth',
'django.contrib.contenttypes',

Binary file not shown.

View File

@ -1,16 +1,16 @@
from django.db import models
from .common import CommonMediaFields
class Book(CommonMediaFields):
author = models.ForeignKey('Author')
series = models.ForeignKey('Series', blank=True)
author = models.ForeignKey('Author', on_delete=models.CASCADE)
series = models.ForeignKey('Series', on_delete=models.CASCADE, 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)
name = models.CharField('Author', unique=True)
sort_name = models.CharField('Author sort name', blank=True)
class Series(models.Model):
name = models.CharFields('Series', unique=True)
name = models.CharField('Series', unique=True)
total_entries = models.PositiveIntegerField('Total Entries', blank=True)

View File

@ -1,4 +1,5 @@
from django.db import models
from django.core import validators
class MediaTypes(models.Model):
MEDIA_TYPES = [
@ -13,8 +14,8 @@ class MediaTypes(models.Model):
)
class CommonMediaFields(models.Model):
name = models.CharField('Title', maxlength=256)
media_type = models.ForeignKey('MediaType')
name = models.CharField('Title', max_length=256)
media_type = models.ForeignKey('MediaType', on_delete=models.CASCADE)
summary = models.TextField('Summary', blank=True)
cover = models.ImageField('Cover Image', blank=True)
backdrop = models.ImageField('Backdrop Image', blank=True)
@ -27,17 +28,17 @@ class CommonMediaFields(models.Model):
### VideoFields is for movies and tv shows
class VideoFields(CommonMediaFields):
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)
tmdb_id = models.CharField('TheMovieDB ID', blank=True)
imdb_id = models.CharField('IMDB ID', blank=True)
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:
abstract = True
class Genres(models.Model):
media = models.ForeignKey('MediaTypes')
genre = models.CharFields('Genre')
media = models.ForeignKey('MediaTypes', on_delete=models.CASCADE)
genre = models.CharField('Genre')
class MediaStatus(models.Model):
media = models.ForeignKey('MediaTypes')
status = models.CharFields('Status')
media = models.ForeignKey('MediaTypes', on_delete=models.CASCADE)
status = models.CharField('Status')

View File

@ -1,10 +1,11 @@
from django.db import models
from django.core import validators
from .common import VideoFields
class Movies(VideoFields):
original_title = models.CharField('Original Title', maxlength=256, blank=True)
original_title = models.CharField('Original Title', max_length=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)
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):

View File

@ -1,16 +1,16 @@
from django.db import models
from .common import VideoFields
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)
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', blank=True)
networks = models.ForeignKey('Networks', on_delete=models.CASCADE, 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')
show = models.ForeignKey('Television', on_delete=models.CASCADE)
network = models.ForeignKey('Networks', on_delete=models.CASCADE)

View File

@ -1,12 +1,12 @@
from django.db import models
from .common import CommonMediaFields
class VGames(CommonMediaFields):
tgdb_id = models.PositiveIntegerField('TheGamesDB ID')
platform = models.ForeignKey('Platform')
platform = models.ForeignKey('Platform', on_delete=models.CASCADE)
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)
mc_rating = models.PositiveIntegerField('MetaCritic Rating', blank=True)
class Publishers(models.Model):
name = models.CharField('Publisher Name')
@ -18,9 +18,9 @@ class Platforms(models.Model):
name = models.CharField('Game System')
class PublisherMap(models.Model):
publisher = models.ForeignKey('Publishers')
game = models.ForeignKey('VGames')
publisher = models.ForeignKey('Publishers', on_delete=models.CASCADE)
game = models.ForeignKey('VGames', on_delete=models.CASCADE)
class DeveloperMap(models.Model):
developer = models.ForeignKey('Developers')
game = models.ForeignKey('VGames')
developer = models.ForeignKey('Developers', on_delete=models.CASCADE)
game = models.ForeignKey('VGames', on_delete=models.CASCADE)