Allow show submission page titles to be displayed instead of the url, if available

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

View File

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

View File

@ -60,7 +60,11 @@
<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}}
{% if sbm.title %}
<span class="urld" title="Web URL: {{sbm.url}}">{{sbm.title}}</span>
{% else %}
<i class="fa fa-fw fa-globe"></i>&nbsp;{{sbm.url}}
{% endif %}
</a>
<div class="vote-btns" data-vote-id="{{sbm.id}}">
<form method="POST" action="/show/{{show.abbr}}/vote/{{sbm.id}}/1">

View File

@ -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():