Added timestamps
This commit is contained in:
parent
f1a6760af7
commit
7e9fdbf3b7
@ -14,7 +14,15 @@ def name_season_artwork(inst, name):
|
|||||||
show_static_storage = FileSystemStorage(location=os.path.join(os.path.dirname(settings.MEDIA_ROOT), 'uploaded_resources'), base_url='showstatic')
|
show_static_storage = FileSystemStorage(location=os.path.join(os.path.dirname(settings.MEDIA_ROOT), 'uploaded_resources'), base_url='showstatic')
|
||||||
|
|
||||||
# Create your models here.
|
# Create your models here.
|
||||||
class Show(models.Model):
|
class TimestampedModel:
|
||||||
|
timestamp = models.DateTimeField(
|
||||||
|
auto_now=True,
|
||||||
|
help_text='The date and time this object was created'
|
||||||
|
)
|
||||||
|
class Meta:
|
||||||
|
abstract = True
|
||||||
|
|
||||||
|
class Show(TimestampedModel):
|
||||||
name = models.CharField(
|
name = models.CharField(
|
||||||
max_length=40,
|
max_length=40,
|
||||||
help_text="The full name of the show",
|
help_text="The full name of the show",
|
||||||
@ -61,7 +69,7 @@ class Show(models.Model):
|
|||||||
verbose_name="Artwork"
|
verbose_name="Artwork"
|
||||||
)
|
)
|
||||||
|
|
||||||
class User(models.Model):
|
class User(TimestampedModel):
|
||||||
auth_token=models.CharField(
|
auth_token=models.CharField(
|
||||||
max_length=16,
|
max_length=16,
|
||||||
help_text="User's authentication token from IcyNet's auth system",
|
help_text="User's authentication token from IcyNet's auth system",
|
||||||
@ -85,7 +93,7 @@ class User(models.Model):
|
|||||||
class Admin(User):
|
class Admin(User):
|
||||||
pass
|
pass
|
||||||
|
|
||||||
class Ban(models.Model):
|
class Ban(TimestampedModel):
|
||||||
user = models.OneToOneField(
|
user = models.OneToOneField(
|
||||||
User,
|
User,
|
||||||
on_delete=models.CASCADE,
|
on_delete=models.CASCADE,
|
||||||
@ -126,7 +134,7 @@ class Ban(models.Model):
|
|||||||
verbose_name = 'Site Wide Ban'
|
verbose_name = 'Site Wide Ban'
|
||||||
)
|
)
|
||||||
|
|
||||||
class ShowModerator(models.Model):
|
class ShowModerator(TimestampedModel):
|
||||||
show = models.ForeignKey(
|
show = models.ForeignKey(
|
||||||
Show,
|
Show,
|
||||||
on_delete=models.CASCADE,
|
on_delete=models.CASCADE,
|
||||||
@ -150,7 +158,7 @@ class ShowModerator(models.Model):
|
|||||||
verbose_name='Appointed by'
|
verbose_name='Appointed by'
|
||||||
)
|
)
|
||||||
|
|
||||||
class Report(models.Model):
|
class Report(TimestampedModel):
|
||||||
reporter = models.ForeignKey(
|
reporter = models.ForeignKey(
|
||||||
User,
|
User,
|
||||||
on_delete=models.SET_NULL,
|
on_delete=models.SET_NULL,
|
||||||
@ -174,7 +182,7 @@ class Report(models.Model):
|
|||||||
verbose_name = 'Content URL'
|
verbose_name = 'Content URL'
|
||||||
)
|
)
|
||||||
|
|
||||||
class ShowSubmission(models.Model):
|
class ShowSubmission(TimestampedModel):
|
||||||
user = models.ForeignKey(
|
user = models.ForeignKey(
|
||||||
User,
|
User,
|
||||||
on_delete=models.CASCADE,
|
on_delete=models.CASCADE,
|
||||||
@ -246,7 +254,7 @@ class Episode(models.Model):
|
|||||||
verbose_name='Original Air Date'
|
verbose_name='Original Air Date'
|
||||||
)
|
)
|
||||||
|
|
||||||
class Submission(models.Model):
|
class Submission(TimestampedModel):
|
||||||
episode = models.ForeignKey(
|
episode = models.ForeignKey(
|
||||||
Episode,
|
Episode,
|
||||||
on_delete=models.CASCADE,
|
on_delete=models.CASCADE,
|
||||||
@ -269,7 +277,7 @@ class Submission(models.Model):
|
|||||||
max_length=200
|
max_length=200
|
||||||
)
|
)
|
||||||
|
|
||||||
class SubmissionVote(models.Model):
|
class SubmissionVote(TimestampedModel):
|
||||||
submission = models.ForeignKey(
|
submission = models.ForeignKey(
|
||||||
Submission,
|
Submission,
|
||||||
on_delete=models.CASCADE,
|
on_delete=models.CASCADE,
|
||||||
@ -286,7 +294,7 @@ class SubmissionVote(models.Model):
|
|||||||
help_text='If this is true, the vote is an upvote. Otherwise, it is a downvote'
|
help_text='If this is true, the vote is an upvote. Otherwise, it is a downvote'
|
||||||
)
|
)
|
||||||
|
|
||||||
class Favorite(models.Model):
|
class Favorite(TimestampedModel):
|
||||||
user = models.ForeignKey(
|
user = models.ForeignKey(
|
||||||
User,
|
User,
|
||||||
on_delete=models.CASCADE
|
on_delete=models.CASCADE
|
||||||
@ -296,7 +304,7 @@ class Favorite(models.Model):
|
|||||||
on_delete=models.CASCADE
|
on_delete=models.CASCADE
|
||||||
)
|
)
|
||||||
|
|
||||||
class Watch(models.Model):
|
class Watch(TimestampedModel):
|
||||||
user = models.ForeignKey(
|
user = models.ForeignKey(
|
||||||
User,
|
User,
|
||||||
on_delete=models.CASCADE
|
on_delete=models.CASCADE
|
||||||
@ -306,7 +314,7 @@ class Watch(models.Model):
|
|||||||
on_delete=models.CASCADE
|
on_delete=models.CASCADE
|
||||||
)
|
)
|
||||||
|
|
||||||
class DiscussionBoard(models.Model):
|
class DiscussionBoard(TimestampedModel):
|
||||||
show = models.ForeignKey(
|
show = models.ForeignKey(
|
||||||
Show,
|
Show,
|
||||||
on_delete=models.CASCADE,
|
on_delete=models.CASCADE,
|
||||||
@ -329,7 +337,7 @@ class DiscussionBoard(models.Model):
|
|||||||
verbose_name='Body'
|
verbose_name='Body'
|
||||||
)
|
)
|
||||||
|
|
||||||
class DiscussionReply(models.Model):
|
class DiscussionReply(TimestampedModel):
|
||||||
board = models.ForeignKey(
|
board = models.ForeignKey(
|
||||||
DiscussionBoard,
|
DiscussionBoard,
|
||||||
on_delete=models.CASCADE,
|
on_delete=models.CASCADE,
|
||||||
@ -348,7 +356,7 @@ class DiscussionReply(models.Model):
|
|||||||
verbose_name='Body'
|
verbose_name='Body'
|
||||||
)
|
)
|
||||||
|
|
||||||
class DiscussionVote(models.Model):
|
class DiscussionVote(TimestampedModel):
|
||||||
user = models.ForeignKey(
|
user = models.ForeignKey(
|
||||||
User,
|
User,
|
||||||
on_delete=models.CASCADE,
|
on_delete=models.CASCADE,
|
||||||
|
Reference in New Issue
Block a user