Pinning of submissions

This commit is contained in:
Evert Prants 2017-12-28 17:34:58 +02:00
parent 2bcf645461
commit 1883792c7f
Signed by: evert
GPG Key ID: 1688DA83D222D0B5
2 changed files with 6 additions and 3 deletions

View File

@ -57,8 +57,11 @@
<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>&nbsp;{{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 %}
<i class="fa fa-fw fa-globe"></i>&nbsp;{{sbm.url}}
</a>
<div class="vote-btns" data-vote-id="{{sbm.id}}">
<form method="POST" action="/show/{{show.abbr}}/vote/{{sbm.id}}/1">
{% csrf_token %}

View File

@ -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