commit
bdfa24c82b
@ -35,7 +35,6 @@ class ShowAdmin(GuardedModelAdmin):
|
||||
admin.site.register(Show, ShowAdmin)
|
||||
admin.site.register(User, SpecialUserAdmin)
|
||||
admin.site.register(Ban)
|
||||
admin.site.register(ShowModerator)
|
||||
admin.site.register(Report)
|
||||
admin.site.register(ShowSubmission)
|
||||
admin.site.register(Season)
|
||||
|
@ -46,7 +46,7 @@ class Show(TimestampedModel):
|
||||
verbose_name="Full Name"
|
||||
)
|
||||
abbr = models.SlugField(
|
||||
max_length=5,
|
||||
max_length=16,
|
||||
unique=True,
|
||||
help_text="A short abbreviation of the show, for use in urls",
|
||||
verbose_name="Abbreviation"
|
||||
@ -76,6 +76,8 @@ class Show(TimestampedModel):
|
||||
css = models.FileField(
|
||||
storage=show_static_storage,
|
||||
upload_to=name_css,
|
||||
null=True,
|
||||
blank=True,
|
||||
help_text="The CSS stylesheet applied to this show's page",
|
||||
verbose_name="Custom Style"
|
||||
)
|
||||
@ -160,32 +162,6 @@ class Ban(TimestampedModel):
|
||||
def __str__(self):
|
||||
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):
|
||||
reporter = models.ForeignKey(
|
||||
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'
|
||||
)
|
||||
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(
|
||||
storage=show_static_storage,
|
||||
@ -311,6 +288,19 @@ class Submission(TimestampedModel):
|
||||
url = models.URLField(
|
||||
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(
|
||||
help_text='Tags applied to this link submission',
|
||||
max_length=200
|
||||
@ -383,6 +373,14 @@ class DiscussionBoard(TimestampedModel):
|
||||
help_text='The body of the post',
|
||||
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):
|
||||
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'
|
||||
}
|
||||
|
||||
class SubmissionFormAdmin(forms.ModelForm):
|
||||
class Meta():
|
||||
model = Submission
|
||||
fields = ('title','url','embed','tags','pinned',)
|
||||
|
||||
class SeasonForm(forms.ModelForm):
|
||||
class Meta():
|
||||
model = Season
|
||||
|
@ -34,7 +34,11 @@
|
||||
<h3>Season {{ episode.season.number }}</h3>
|
||||
{% endif %}
|
||||
<p class="description">
|
||||
{% if episode.season.description %}
|
||||
{{ episode.season.description }}
|
||||
{% else %}
|
||||
{{ show.description }}
|
||||
{% endif %}
|
||||
</p>
|
||||
</div>
|
||||
</div>
|
||||
@ -53,8 +57,15 @@
|
||||
<h1>Watch <q>{{episode.name}}</q> From</h1>
|
||||
<div class="submission-list">
|
||||
{% for sbm in submissions %}
|
||||
<div class="submission{% if sbm.positives < sbm.negatives %} buried{% endif %}">
|
||||
<a href="{{sbm.url}}" class="link"><i class="fa fa-fw fa-globe"></i> {{sbm.url}}</a>
|
||||
<div class="submission{% if sbm.positives < sbm.negatives %} buried{% endif %}{% if sbm.pinned %} pinned{% endif %}">
|
||||
<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}}">
|
||||
<form method="POST" action="/show/{{show.abbr}}/vote/{{sbm.id}}/1">
|
||||
{% csrf_token %}
|
||||
|
@ -7,12 +7,25 @@
|
||||
<div class="banner" style="background-image: url(/media/uploaded_resources/{{show.banner}});"></div>
|
||||
<div class="banner-cover">
|
||||
<div class="artwork">
|
||||
{% if episode.season.artwork %}
|
||||
<img src="/media/uploaded_resources/{{season.artwork}}">
|
||||
{% else %}
|
||||
<img src="/media/uploaded_resources/{{show.artwork}}">
|
||||
{% endif %}
|
||||
</div>
|
||||
<div class="details">
|
||||
<div class="details season">
|
||||
<h1>{{show.name}}</h1>
|
||||
{% if season.name %}
|
||||
<h3>{{ season.name }}</h3>
|
||||
{% else %}
|
||||
<h3>Season {{ season.number }}</h3>
|
||||
{% endif %}
|
||||
<p class="description">
|
||||
{{show.description}}
|
||||
{% if season.description %}
|
||||
{{ season.description }}
|
||||
{% else %}
|
||||
{{ show.description }}
|
||||
{% endif %}
|
||||
</p>
|
||||
</div>
|
||||
</div>
|
||||
|
@ -21,7 +21,11 @@
|
||||
<h3>Season {{ episode.season.number }}</h3>
|
||||
{% endif %}
|
||||
<p class="description">
|
||||
{% if episode.season.description %}
|
||||
{{ episode.season.description }}
|
||||
{% else %}
|
||||
{{ show.description }}
|
||||
{% endif %}
|
||||
</p>
|
||||
</div>
|
||||
</div>
|
||||
|
@ -21,7 +21,11 @@
|
||||
<h3>Season {{ episode.season.number }}</h3>
|
||||
{% endif %}
|
||||
<p class="description">
|
||||
{% if episode.season.description %}
|
||||
{{ episode.season.description }}
|
||||
{% else %}
|
||||
{{ show.description }}
|
||||
{% endif %}
|
||||
</p>
|
||||
</div>
|
||||
</div>
|
||||
|
@ -76,7 +76,7 @@ class EpisodeView(TemplateView):
|
||||
),
|
||||
negatives=Count('votes') - F('positives'),
|
||||
score=F('positives') - F('negatives')
|
||||
).order_by('-score')
|
||||
).order_by('-pinned', '-score')
|
||||
|
||||
# Add fields to context
|
||||
ctx['show'] = show
|
||||
@ -145,7 +145,7 @@ def SubmissionModForm(req, abbr, submission):
|
||||
episode = submission.episode
|
||||
user = req.user
|
||||
|
||||
form = forms.SubmissionForm(instance=submission)
|
||||
form = forms.SubmissionFormAdmin(instance=submission)
|
||||
|
||||
# Request context
|
||||
ctx = {
|
||||
@ -164,7 +164,7 @@ def SubmissionModForm(req, abbr, submission):
|
||||
submission.delete()
|
||||
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
|
||||
|
||||
if form.is_valid():
|
||||
|
Reference in New Issue
Block a user