Added the rest of the tables
This commit is contained in:
parent
3cf80e1255
commit
7c8b06433c
@ -9,10 +9,12 @@ def name_css(inst, name):
|
||||
return '%s/style.css'%inst.abbr
|
||||
def name_banner(inst, name):
|
||||
return '%s/banner.%s'%(inst.abbr,name.split('.')[-1])
|
||||
def name_season_artwork(inst, name):
|
||||
return '%s/%d/artwork.%s'%(inst.show.abbr,inst.number,name.split('.')[-1])
|
||||
show_static_storage = FileSystemStorage(location=os.path.join(os.path.dirname(settings.MEDIA_ROOT), 'uploaded_resources'), base_url='showstatic')
|
||||
|
||||
# Create your models here.
|
||||
class Show(models.Model):
|
||||
show_static_storage = FileSystemStorage(location=os.path.join(os.path.dirname(settings.MEDIA_ROOT), 'uploaded_resources'), base_url='showstatic')
|
||||
name = models.CharField(
|
||||
max_length=40,
|
||||
help_text="The full name of the show",
|
||||
@ -70,6 +72,15 @@ class User(models.Model):
|
||||
help_text="The name shown to other users",
|
||||
verbose_name="Display Name"
|
||||
)
|
||||
favorites=models.ManyToManyField(
|
||||
'Episode',
|
||||
related_name='favorited_by',
|
||||
through='Favorite'
|
||||
)
|
||||
watches=models.ManyToManyField(
|
||||
'Episode',
|
||||
related_name='watched_by',
|
||||
through='Watch'
|
||||
|
||||
class Admin(User):
|
||||
pass
|
||||
@ -114,6 +125,7 @@ class Ban(models.Model):
|
||||
help_text='If checked, this is a site-wide ban, and the user is automatically banned from all shows, not just those in the Banned From (scope) paramenter',
|
||||
verbose_name = 'Site Wide Ban'
|
||||
)
|
||||
|
||||
class ShowModerator(models.Model):
|
||||
show = models.ForeignKey(
|
||||
Show,
|
||||
@ -137,6 +149,7 @@ class ShowModerator(models.Model):
|
||||
help_text='The user who appointed this moderator',
|
||||
verbose_name='Appointed by'
|
||||
)
|
||||
|
||||
class Report(models.Model):
|
||||
reporter = models.ForeignKey(
|
||||
User,
|
||||
@ -160,6 +173,7 @@ class Report(models.Model):
|
||||
help_text='The URL of the content being reported',
|
||||
verbose_name = 'Content URL'
|
||||
)
|
||||
|
||||
class ShowSubmission(models.Model):
|
||||
user = models.ForeignKey(
|
||||
User,
|
||||
@ -173,3 +187,176 @@ class ShowSubmission(models.Model):
|
||||
help_text='Some details about the show. Why it should be added, where information about it can be found, etc.',
|
||||
verbose_name='Details'
|
||||
)
|
||||
|
||||
# Create your models here.
|
||||
class Season(models.Model):
|
||||
show = models.ForeignKey(
|
||||
'Show',
|
||||
on_delete=models.CASCADE,
|
||||
related_name='seasons',
|
||||
help_text='The show this season belongs to'
|
||||
)
|
||||
name = models.CharField(
|
||||
max_length=40,
|
||||
blank=True,
|
||||
help_text='The name given to this season by its producers. Can be blank if no name was given',
|
||||
verbose_name='Season Name'
|
||||
)
|
||||
number = models.IntegerField(
|
||||
help_text='The number of this season, starting at 1; For example, the first season to be aired would be number 1, and the second would be number 2'
|
||||
)
|
||||
description = models.TextField(
|
||||
help_text='A description of this season\'s happenings'
|
||||
)
|
||||
artwork = models.ImageField(
|
||||
storage=show_static_storage,
|
||||
upload_to = name_season_artwork,
|
||||
help_text="The artwork associated with the season. Should display the name of the show in a movie-poster esque format. Aspect ration should be about 2:3",
|
||||
verbose_name="Artwork",
|
||||
blank=True
|
||||
)
|
||||
|
||||
class Episode(models.Model):
|
||||
show = models.ForeignKey(
|
||||
'Show',
|
||||
on_delete=models.CASCADE,
|
||||
related_name='episodes',
|
||||
help_text='The show this episode belongs to'
|
||||
)
|
||||
season = models.ForeignKey(
|
||||
Season,
|
||||
on_delete=models.CASCADE,
|
||||
related_name='episodes',
|
||||
help_text='The season this episode is from'
|
||||
)
|
||||
episode = models.IntegerField(
|
||||
help_text='The position of this episode in the season. The first episode of the season to air would be episode number 1',
|
||||
verbose_name='Episode Number'
|
||||
)
|
||||
name = models.CharField(
|
||||
max_length=40,
|
||||
help_text='The name given to this episode by its producers',
|
||||
verbose_name='Episode Season'
|
||||
)
|
||||
summary = models.TextField(
|
||||
help_text='A summary of this episode'
|
||||
)
|
||||
airdate = models.DateField(
|
||||
help_text='The date this episode officially aired for the first time',
|
||||
verbose_name='Original Air Date'
|
||||
)
|
||||
|
||||
class Submission(models.Model):
|
||||
episode = models.ForeignKey(
|
||||
Episode,
|
||||
on_delete=models.CASCADE,
|
||||
related_name='submissions',
|
||||
help_text='What episode this link contains a mirror of',
|
||||
verbose_name='Submitted For'
|
||||
)
|
||||
user = models.ForeignKey(
|
||||
'User',
|
||||
on_delete=models.SET_NULL,
|
||||
null=True,
|
||||
related_name='submissions',
|
||||
help_text='The user who submitted this link'
|
||||
)
|
||||
url = models.URLField(
|
||||
help_text='The link that was submitted',
|
||||
)
|
||||
tags = models.CharField(
|
||||
help_text='Tags applied to this link submission',
|
||||
max_length=200
|
||||
)
|
||||
|
||||
class SubmissionVote(models.Model):
|
||||
submission = models.ForeignKey(
|
||||
Submission,
|
||||
on_delete=models.CASCADE,
|
||||
related_name='votes',
|
||||
help_text='What this submission was cast on'
|
||||
)
|
||||
user = models.ForeignKey(
|
||||
'User',
|
||||
on_delete=models.CASCADE,
|
||||
related_name='votes',
|
||||
help_text='The user who cast this vote'
|
||||
)
|
||||
positive = models.BooleanField(
|
||||
help_text='If this is true, the vote is an upvote. Otherwise, it is a downvote'
|
||||
)
|
||||
|
||||
class Favorite(models.Model):
|
||||
user = models.ForeignKey(
|
||||
User,
|
||||
on_delete=models.CASCADE
|
||||
)
|
||||
episode = models.ForeignKey(
|
||||
Episode,
|
||||
on_delete=models.CASCADE
|
||||
)
|
||||
|
||||
class Watch(models.Model):
|
||||
user = models.ForeignKey(
|
||||
User,
|
||||
on_delete=models.CASCADE
|
||||
)
|
||||
episode = models.ForeignKey(
|
||||
Episode,
|
||||
on_delete=models.CASCADE
|
||||
)
|
||||
|
||||
class DiscussionBoard(models.Model):
|
||||
show = models.ForeignKey(
|
||||
Show,
|
||||
on_delete=models.CASCADE,
|
||||
related_name='discussion_boards',
|
||||
help_text='The show this discussion was created for'
|
||||
)
|
||||
user = models.ForeignKey(
|
||||
User,
|
||||
on_delete=models.SET_NULL,
|
||||
null=True,
|
||||
related_name='discussion_boards',
|
||||
help_text='The user that created this discussion'
|
||||
)
|
||||
title = models.CharField(
|
||||
max_length=100,
|
||||
help_text='The title of the discussion'
|
||||
)
|
||||
body = models.TextField(
|
||||
help_text='The body of the post'
|
||||
verbose_name='Body'
|
||||
)
|
||||
|
||||
class DiscussionReply(models.Model):
|
||||
board = models.ForeignKey(
|
||||
DiscussionBoard,
|
||||
on_delete=models.CASCADE,
|
||||
related_name='replies',
|
||||
help_text='The discussion board this was created in reply to'
|
||||
)
|
||||
user = models.ForeignKey(
|
||||
User,
|
||||
on_delete=models.SET_NULL,
|
||||
null=True,
|
||||
related_name='replies',
|
||||
help_text='The user that posted this reply'
|
||||
)
|
||||
body = models.TextField(
|
||||
help_text='The body of the response'
|
||||
verbose_name='Body'
|
||||
)
|
||||
|
||||
class DiscussionVote(models.Model):
|
||||
user = models.ForeignKey(
|
||||
User,
|
||||
on_delete=models.CASCADE
|
||||
)
|
||||
board = models.ForeignKey(
|
||||
DiscussionBoard,
|
||||
on_delete=models.CASCADE
|
||||
)
|
||||
postive = models.BooleanField(
|
||||
help_text='If true, the vote is an upvote. Otherwise, it is a downvote. Neutral votes are not recorded'
|
||||
)
|
||||
|
Reference in New Issue
Block a user