further model building
parent
cffb873298
commit
b016a4c649
|
@ -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)
|
|
@ -10,25 +10,27 @@ class MediaTypes(models.Model):
|
||||||
media_type = models.CharField(
|
media_type = models.CharField(
|
||||||
max_length=2,
|
max_length=2,
|
||||||
choices=MEDIA_TYPES,
|
choices=MEDIA_TYPES,
|
||||||
default='mo',
|
|
||||||
)
|
)
|
||||||
|
|
||||||
class CommonMediaFields(models.Model):
|
class CommonMediaFields(models.Model):
|
||||||
name = models.CharField('Title', maxlength=256)
|
name = models.CharField('Title', maxlength=256)
|
||||||
media_type = models.ForeignKey('MediaType')
|
media_type = models.ForeignKey('MediaType')
|
||||||
summary = models.TextField('Summary')
|
summary = models.TextField('Summary', blank=True)
|
||||||
release_date = models.DateField('Release Date')
|
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)
|
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')
|
original_language = models.CharField('Original Language', blank=True)
|
||||||
class Meta:
|
class Meta:
|
||||||
abstract = True
|
abstract = True
|
||||||
|
|
||||||
|
### VideoFields is for movies and tv shows
|
||||||
class VideoFields(CommonFields):
|
class VideoFields(CommonFields):
|
||||||
tmdb_id = models.PositiveIntegerField('TheMovieDB ID')
|
tmdb_id = models.PositiveIntegerField('TheMovieDB ID', blank=True)
|
||||||
imdb_id = models.PositiveIntegerField('IMDB ID')
|
imdb_id = models.PositiveIntegerField('IMDB ID', blank=True)
|
||||||
tmdb_rating = models.PositiveIntegerField('TheMovieDB rating', max_value=100)
|
tmdb_rating = models.PositiveIntegerField('TheMovieDB rating', max_value=100, blank=True)
|
||||||
mc_rating = models.PositiveIntegerFrield('MetaCritic Rating', max_value=100)
|
mc_rating = models.PositiveIntegerFrield('MetaCritic Rating', max_value=100, blank=True)
|
||||||
class Meta:
|
class Meta:
|
||||||
abstract = True
|
abstract = True
|
||||||
|
|
||||||
|
|
|
@ -1,17 +1,17 @@
|
||||||
|
from django.db import models
|
||||||
|
|
||||||
class Film(VideoFields):
|
class Film(VideoFields):
|
||||||
original_title = models.CharField('Original Title', maxlength=256)
|
original_title = models.CharField('Original Title', maxlength=256, blank=True)
|
||||||
tagline = modelx.CharField('Tagline')
|
tagline = models.CharField('Tagline', blank=True)
|
||||||
runtime = models.PositiveIntegerField('Total Runtime')
|
runtime = models.PositiveIntegerField('Total Runtime', blank=True)
|
||||||
cover = models.ImageField('Cover Image')
|
rt_rating = models.PositiveIntegerField('Rotten Tomatoes Rating', max_value=100, blank=True)
|
||||||
backdrop = models.ImageField('Backdrop Image')
|
am_rating = models.DecimalField('AllMovie Rating', max_digits=3, decimal_places=1, blank=True)
|
||||||
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):
|
class FilmAltTitles(models.Model):
|
||||||
film = models.ForeignKey('Film', on_delete=models.CASCADE)
|
film = models.ForeignKey('Film', on_delete=models.CASCADE)
|
||||||
title = models.CharField('Title')
|
title = models.CharField('Title')
|
||||||
country = models.CharField('Country')
|
country = models.CharField('Country')
|
||||||
type = models.CharField('Type')
|
title_type = models.CharField('Type', blank=True)
|
||||||
|
|
||||||
class FilmGenres(models.Model):
|
class FilmGenres(models.Model):
|
||||||
film = models.ForeignKey('Film', on_delete=models.CASCADE)
|
film = models.ForeignKey('Film', on_delete=models.CASCADE)
|
||||||
|
|
|
@ -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')
|
|
@ -1,9 +1,26 @@
|
||||||
|
from django.db import models
|
||||||
|
|
||||||
class VGames(CommonMediaFields)
|
class VGames(CommonMediaFields)
|
||||||
tgdb_id = models.PositiveIntegerField('TheGamesDB ID')
|
tgdb_id = models.PositiveIntegerField('TheGamesDB ID')
|
||||||
platform = models.ForeignKey('Platform')
|
platform = models.ForeignKey('Platform')
|
||||||
developer = models.CharField('Developers')
|
cover = models.ImageField('Cover Image', blank=True)
|
||||||
publisher = models.CharField('Publishers')
|
players = models.PositiveIntegerField('Players', blank=True)
|
||||||
cover = models.ImageField('Cover Image')
|
coop = models.BooleanField('Co-Op', blank=True)
|
||||||
players = models.PositiveIntegerField('Players')
|
mc_rating = models.PositiveIntegerFrield('MetaCritic Rating', max_value=100, blank=True)
|
||||||
coop = models.BooleanField('Co-Op')
|
|
||||||
|
|
||||||
|
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')
|
||||||
|
|
Loading…
Reference in New Issue