commit
bdfa24c82b
@ -35,7 +35,6 @@ class ShowAdmin(GuardedModelAdmin):
|
|||||||
admin.site.register(Show, ShowAdmin)
|
admin.site.register(Show, ShowAdmin)
|
||||||
admin.site.register(User, SpecialUserAdmin)
|
admin.site.register(User, SpecialUserAdmin)
|
||||||
admin.site.register(Ban)
|
admin.site.register(Ban)
|
||||||
admin.site.register(ShowModerator)
|
|
||||||
admin.site.register(Report)
|
admin.site.register(Report)
|
||||||
admin.site.register(ShowSubmission)
|
admin.site.register(ShowSubmission)
|
||||||
admin.site.register(Season)
|
admin.site.register(Season)
|
||||||
|
@ -46,7 +46,7 @@ class Show(TimestampedModel):
|
|||||||
verbose_name="Full Name"
|
verbose_name="Full Name"
|
||||||
)
|
)
|
||||||
abbr = models.SlugField(
|
abbr = models.SlugField(
|
||||||
max_length=5,
|
max_length=16,
|
||||||
unique=True,
|
unique=True,
|
||||||
help_text="A short abbreviation of the show, for use in urls",
|
help_text="A short abbreviation of the show, for use in urls",
|
||||||
verbose_name="Abbreviation"
|
verbose_name="Abbreviation"
|
||||||
@ -76,6 +76,8 @@ class Show(TimestampedModel):
|
|||||||
css = models.FileField(
|
css = models.FileField(
|
||||||
storage=show_static_storage,
|
storage=show_static_storage,
|
||||||
upload_to=name_css,
|
upload_to=name_css,
|
||||||
|
null=True,
|
||||||
|
blank=True,
|
||||||
help_text="The CSS stylesheet applied to this show's page",
|
help_text="The CSS stylesheet applied to this show's page",
|
||||||
verbose_name="Custom Style"
|
verbose_name="Custom Style"
|
||||||
)
|
)
|
||||||
@ -160,32 +162,6 @@ class Ban(TimestampedModel):
|
|||||||
def __str__(self):
|
def __str__(self):
|
||||||
return ("Permanent" if self.permanent else "Temporary") + " ban of %s"%self.user
|
return ("Permanent" if self.permanent else "Temporary") + " ban of %s"%self.user
|
||||||
|
|
||||||
class ShowModerator(TimestampedModel):
|
|
||||||
show = models.ForeignKey(
|
|
||||||
Show,
|
|
||||||
on_delete=models.CASCADE,
|
|
||||||
help_text='The show this user moderates',
|
|
||||||
verbose_name='Moderated Show',
|
|
||||||
related_name='moderators',
|
|
||||||
)
|
|
||||||
user = models.ForeignKey(
|
|
||||||
User,
|
|
||||||
on_delete=models.CASCADE,
|
|
||||||
help_text='The user who moderates this show',
|
|
||||||
verbose_name='Moderator',
|
|
||||||
related_name='moderated_shows'
|
|
||||||
)
|
|
||||||
appointed_by = models.ForeignKey(
|
|
||||||
User,
|
|
||||||
on_delete=models.SET_NULL,
|
|
||||||
related_name='appointed_mods',
|
|
||||||
null=True,
|
|
||||||
help_text='The user who appointed this moderator',
|
|
||||||
verbose_name='Appointed by'
|
|
||||||
)
|
|
||||||
def __str__(self):
|
|
||||||
return "%s on %s"%(self.user,self.show.abbr)
|
|
||||||
|
|
||||||
class Report(TimestampedModel):
|
class Report(TimestampedModel):
|
||||||
reporter = models.ForeignKey(
|
reporter = models.ForeignKey(
|
||||||
User,
|
User,
|
||||||
@ -249,7 +225,8 @@ class Season(models.Model):
|
|||||||
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'
|
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(
|
description = models.TextField(
|
||||||
help_text='A description of this season\'s happenings'
|
help_text='A description of this season\'s happenings',
|
||||||
|
blank=True
|
||||||
)
|
)
|
||||||
artwork = models.ImageField(
|
artwork = models.ImageField(
|
||||||
storage=show_static_storage,
|
storage=show_static_storage,
|
||||||
@ -311,6 +288,19 @@ class Submission(TimestampedModel):
|
|||||||
url = models.URLField(
|
url = models.URLField(
|
||||||
help_text='The link that was submitted',
|
help_text='The link that was submitted',
|
||||||
)
|
)
|
||||||
|
title = models.TextField(
|
||||||
|
help_text='Title of the page',
|
||||||
|
blank=True
|
||||||
|
)
|
||||||
|
embed = models.URLField(
|
||||||
|
help_text='Embed player link for this episode',
|
||||||
|
blank=True,
|
||||||
|
verbose_name='Embed URL'
|
||||||
|
)
|
||||||
|
pinned = models.BooleanField(
|
||||||
|
help_text='Whether or not this submission is pinned',
|
||||||
|
default=False
|
||||||
|
)
|
||||||
tags = models.CharField(
|
tags = models.CharField(
|
||||||
help_text='Tags applied to this link submission',
|
help_text='Tags applied to this link submission',
|
||||||
max_length=200
|
max_length=200
|
||||||
@ -383,6 +373,14 @@ class DiscussionBoard(TimestampedModel):
|
|||||||
help_text='The body of the post',
|
help_text='The body of the post',
|
||||||
verbose_name='Body'
|
verbose_name='Body'
|
||||||
)
|
)
|
||||||
|
views = models.IntegerField(
|
||||||
|
help_text='The amount of times this board has been viewed',
|
||||||
|
default=0
|
||||||
|
)
|
||||||
|
pinned = models.BooleanField(
|
||||||
|
help_text='Whether or not this board is pinned',
|
||||||
|
default=False
|
||||||
|
)
|
||||||
def __str__(self):
|
def __str__(self):
|
||||||
return '[%s] "%s" by %s'%(self.show.abbr, self.title, self.user)
|
return '[%s] "%s" by %s'%(self.show.abbr, self.title, self.user)
|
||||||
|
|
||||||
|
@ -26,6 +26,11 @@ class SubmissionForm(forms.ModelForm):
|
|||||||
'tags': 'Describe your link. Comma-separated list of keywords'
|
'tags': 'Describe your link. Comma-separated list of keywords'
|
||||||
}
|
}
|
||||||
|
|
||||||
|
class SubmissionFormAdmin(forms.ModelForm):
|
||||||
|
class Meta():
|
||||||
|
model = Submission
|
||||||
|
fields = ('title','url','embed','tags','pinned',)
|
||||||
|
|
||||||
class SeasonForm(forms.ModelForm):
|
class SeasonForm(forms.ModelForm):
|
||||||
class Meta():
|
class Meta():
|
||||||
model = Season
|
model = Season
|
||||||
|
@ -34,7 +34,11 @@
|
|||||||
<h3>Season {{ episode.season.number }}</h3>
|
<h3>Season {{ episode.season.number }}</h3>
|
||||||
{% endif %}
|
{% endif %}
|
||||||
<p class="description">
|
<p class="description">
|
||||||
{{ episode.season.description }}
|
{% if episode.season.description %}
|
||||||
|
{{ episode.season.description }}
|
||||||
|
{% else %}
|
||||||
|
{{ show.description }}
|
||||||
|
{% endif %}
|
||||||
</p>
|
</p>
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
@ -53,8 +57,15 @@
|
|||||||
<h1>Watch <q>{{episode.name}}</q> From</h1>
|
<h1>Watch <q>{{episode.name}}</q> From</h1>
|
||||||
<div class="submission-list">
|
<div class="submission-list">
|
||||||
{% for sbm in submissions %}
|
{% for sbm in submissions %}
|
||||||
<div class="submission{% if sbm.positives < sbm.negatives %} buried{% endif %}">
|
<div class="submission{% if sbm.positives < sbm.negatives %} buried{% endif %}{% if sbm.pinned %} pinned{% endif %}">
|
||||||
<a href="{{sbm.url}}" class="link"><i class="fa fa-fw fa-globe"></i> {{sbm.url}}</a>
|
<a href="{{sbm.url}}" class="link">
|
||||||
|
{% if sbm.pinned %}<i class="fa fa-fw fa-thumb-tack" title="Pinned submission"></i>{% endif %}
|
||||||
|
{% if sbm.title %}
|
||||||
|
<span class="urld" title="Web URL: {{sbm.url}}">{{sbm.title}}</span>
|
||||||
|
{% else %}
|
||||||
|
<i class="fa fa-fw fa-globe"></i> {{sbm.url}}
|
||||||
|
{% endif %}
|
||||||
|
</a>
|
||||||
<div class="vote-btns" data-vote-id="{{sbm.id}}">
|
<div class="vote-btns" data-vote-id="{{sbm.id}}">
|
||||||
<form method="POST" action="/show/{{show.abbr}}/vote/{{sbm.id}}/1">
|
<form method="POST" action="/show/{{show.abbr}}/vote/{{sbm.id}}/1">
|
||||||
{% csrf_token %}
|
{% csrf_token %}
|
||||||
|
@ -7,12 +7,25 @@
|
|||||||
<div class="banner" style="background-image: url(/media/uploaded_resources/{{show.banner}});"></div>
|
<div class="banner" style="background-image: url(/media/uploaded_resources/{{show.banner}});"></div>
|
||||||
<div class="banner-cover">
|
<div class="banner-cover">
|
||||||
<div class="artwork">
|
<div class="artwork">
|
||||||
<img src="/media/uploaded_resources/{{show.artwork}}">
|
{% if episode.season.artwork %}
|
||||||
|
<img src="/media/uploaded_resources/{{season.artwork}}">
|
||||||
|
{% else %}
|
||||||
|
<img src="/media/uploaded_resources/{{show.artwork}}">
|
||||||
|
{% endif %}
|
||||||
</div>
|
</div>
|
||||||
<div class="details">
|
<div class="details season">
|
||||||
<h1>{{show.name}}</h1>
|
<h1>{{show.name}}</h1>
|
||||||
|
{% if season.name %}
|
||||||
|
<h3>{{ season.name }}</h3>
|
||||||
|
{% else %}
|
||||||
|
<h3>Season {{ season.number }}</h3>
|
||||||
|
{% endif %}
|
||||||
<p class="description">
|
<p class="description">
|
||||||
{{show.description}}
|
{% if season.description %}
|
||||||
|
{{ season.description }}
|
||||||
|
{% else %}
|
||||||
|
{{ show.description }}
|
||||||
|
{% endif %}
|
||||||
</p>
|
</p>
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
|
@ -21,7 +21,11 @@
|
|||||||
<h3>Season {{ episode.season.number }}</h3>
|
<h3>Season {{ episode.season.number }}</h3>
|
||||||
{% endif %}
|
{% endif %}
|
||||||
<p class="description">
|
<p class="description">
|
||||||
{{ episode.season.description }}
|
{% if episode.season.description %}
|
||||||
|
{{ episode.season.description }}
|
||||||
|
{% else %}
|
||||||
|
{{ show.description }}
|
||||||
|
{% endif %}
|
||||||
</p>
|
</p>
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
|
@ -21,7 +21,11 @@
|
|||||||
<h3>Season {{ episode.season.number }}</h3>
|
<h3>Season {{ episode.season.number }}</h3>
|
||||||
{% endif %}
|
{% endif %}
|
||||||
<p class="description">
|
<p class="description">
|
||||||
{{ episode.season.description }}
|
{% if episode.season.description %}
|
||||||
|
{{ episode.season.description }}
|
||||||
|
{% else %}
|
||||||
|
{{ show.description }}
|
||||||
|
{% endif %}
|
||||||
</p>
|
</p>
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
|
@ -76,7 +76,7 @@ class EpisodeView(TemplateView):
|
|||||||
),
|
),
|
||||||
negatives=Count('votes') - F('positives'),
|
negatives=Count('votes') - F('positives'),
|
||||||
score=F('positives') - F('negatives')
|
score=F('positives') - F('negatives')
|
||||||
).order_by('-score')
|
).order_by('-pinned', '-score')
|
||||||
|
|
||||||
# Add fields to context
|
# Add fields to context
|
||||||
ctx['show'] = show
|
ctx['show'] = show
|
||||||
@ -145,7 +145,7 @@ def SubmissionModForm(req, abbr, submission):
|
|||||||
episode = submission.episode
|
episode = submission.episode
|
||||||
user = req.user
|
user = req.user
|
||||||
|
|
||||||
form = forms.SubmissionForm(instance=submission)
|
form = forms.SubmissionFormAdmin(instance=submission)
|
||||||
|
|
||||||
# Request context
|
# Request context
|
||||||
ctx = {
|
ctx = {
|
||||||
@ -164,7 +164,7 @@ def SubmissionModForm(req, abbr, submission):
|
|||||||
submission.delete()
|
submission.delete()
|
||||||
return HttpResponseRedirect('/show/%s/create_ban?user=%s'%(abbr,submission.user.username))
|
return HttpResponseRedirect('/show/%s/create_ban?user=%s'%(abbr,submission.user.username))
|
||||||
|
|
||||||
form = forms.SubmissionForm(req.POST, instance=submission)
|
form = forms.SubmissionFormAdmin(req.POST, instance=submission)
|
||||||
ctx['form'] = form
|
ctx['form'] = form
|
||||||
|
|
||||||
if form.is_valid():
|
if form.is_valid():
|
||||||
|
Reference in New Issue
Block a user