Use a function to create show urls instead of having them static
This commit is contained in:
parent
ed720adbc5
commit
adb14fe486
@ -39,6 +39,7 @@
|
|||||||
{% if "can_moderate_board" in show_perms or board.user == user %}
|
{% if "can_moderate_board" in show_perms or board.user == user %}
|
||||||
<div class="alert alert-warning"><div class="font-weight-light">{{reply.body}}</div></div>
|
<div class="alert alert-warning"><div class="font-weight-light">{{reply.body}}</div></div>
|
||||||
<a href="{{showurl}}/discuss/board/delete/reply/{{reply.id}}" class="btn btn-warning ml-1">Restore</a>
|
<a href="{{showurl}}/discuss/board/delete/reply/{{reply.id}}" class="btn btn-warning ml-1">Restore</a>
|
||||||
|
<a href="{{showurl}}/create_ban?user={{reply.user.username}}" class="btn btn-warning ml-1">Ban</a>
|
||||||
{% endif %}
|
{% endif %}
|
||||||
<div class="w-100 mb-4"></div>
|
<div class="w-100 mb-4"></div>
|
||||||
{% else %}
|
{% else %}
|
||||||
|
@ -29,15 +29,12 @@ from django.utils.text import slugify
|
|||||||
from guardian.decorators import permission_required_or_403
|
from guardian.decorators import permission_required_or_403
|
||||||
|
|
||||||
from LandingPage.models import Show, DiscussionBoard, DiscussionReply, DiscussionVote, Ban, Report
|
from LandingPage.models import Show, DiscussionBoard, DiscussionReply, DiscussionVote, Ban, Report
|
||||||
|
from LandingPage.views import get_show_url
|
||||||
from . import forms
|
from . import forms
|
||||||
|
|
||||||
import datetime
|
import datetime
|
||||||
import re
|
import re
|
||||||
|
|
||||||
# Append common values to context
|
|
||||||
def get_show_url(abbr):
|
|
||||||
return '/show/%s' % (abbr)
|
|
||||||
|
|
||||||
class Boards(TemplateView):
|
class Boards(TemplateView):
|
||||||
|
|
||||||
template_name = "boards.html"
|
template_name = "boards.html"
|
||||||
|
@ -31,7 +31,10 @@ from .models import Show
|
|||||||
from .models import Submission
|
from .models import Submission
|
||||||
from .models import DiscussionBoard
|
from .models import DiscussionBoard
|
||||||
|
|
||||||
# Create your views here.
|
# Get a show's URL by its abbreviation
|
||||||
|
def get_show_url(abbr):
|
||||||
|
return '/show/%s' % (abbr)
|
||||||
|
|
||||||
# Redirect url should point to this view
|
# Redirect url should point to this view
|
||||||
class LoginRedirect(View):
|
class LoginRedirect(View):
|
||||||
def get(self, req):
|
def get(self, req):
|
||||||
|
@ -7,7 +7,7 @@
|
|||||||
<section class="container mt-2 mb-5">
|
<section class="container mt-2 mb-5">
|
||||||
<nav aria-label="breadcrumb">
|
<nav aria-label="breadcrumb">
|
||||||
<ol class="breadcrumb">
|
<ol class="breadcrumb">
|
||||||
<li class="breadcrumb-item"><a href="/show/{{show.abbr}}">{{show.name}}</a></li>
|
<li class="breadcrumb-item"><a href="{{showurl}}">{{show.name}}</a></li>
|
||||||
<li class="breadcrumb-item active" aria-current="page">New Season</li>
|
<li class="breadcrumb-item active" aria-current="page">New Season</li>
|
||||||
</ol>
|
</ol>
|
||||||
</nav>
|
</nav>
|
||||||
|
@ -46,7 +46,7 @@
|
|||||||
<section class="container mb-5 mt-2">
|
<section class="container mb-5 mt-2">
|
||||||
<nav aria-label="breadcrumb">
|
<nav aria-label="breadcrumb">
|
||||||
<ol class="breadcrumb">
|
<ol class="breadcrumb">
|
||||||
<li class="breadcrumb-item"><a href="/show/{{show.abbr}}">{{show.name}}</a></li>
|
<li class="breadcrumb-item"><a href="{{showurl}}">{{show.name}}</a></li>
|
||||||
<li class="breadcrumb-item active" aria-current="page">{{episode.name}}</li>
|
<li class="breadcrumb-item active" aria-current="page">{{episode.name}}</li>
|
||||||
</ol>
|
</ol>
|
||||||
</nav>
|
</nav>
|
||||||
@ -68,13 +68,13 @@
|
|||||||
</div>
|
</div>
|
||||||
<div class="col-md-2 text-md-right">
|
<div class="col-md-2 text-md-right">
|
||||||
<div class="vote-btns" data-vote-id="{{sbm.id}}">
|
<div class="vote-btns" data-vote-id="{{sbm.id}}">
|
||||||
<form method="POST" class="d-inline" action="/show/{{show.abbr}}/vote/{{sbm.id}}/1">
|
<form method="POST" class="d-inline" action="{{showurl}}/vote/{{sbm.id}}/1">
|
||||||
{% csrf_token %}
|
{% csrf_token %}
|
||||||
<button class="btn btn-success">
|
<button class="btn btn-success">
|
||||||
<i class="fa fa-fw fa-thumbs-up"></i> {{sbm.positives}}
|
<i class="fa fa-fw fa-thumbs-up"></i> {{sbm.positives}}
|
||||||
</button>
|
</button>
|
||||||
</form>
|
</form>
|
||||||
<form method="POST" class="d-inline" action="/show/{{show.abbr}}/vote/{{sbm.id}}/0">
|
<form method="POST" class="d-inline" action="{{showurl}}/vote/{{sbm.id}}/0">
|
||||||
{% csrf_token %}
|
{% csrf_token %}
|
||||||
<button class="btn btn-danger">
|
<button class="btn btn-danger">
|
||||||
<i class="fa fa-fw fa-thumbs-down"></i> {{sbm.negatives}}
|
<i class="fa fa-fw fa-thumbs-down"></i> {{sbm.negatives}}
|
||||||
@ -93,9 +93,9 @@
|
|||||||
</span>
|
</span>
|
||||||
<span class="divider">·</span>
|
<span class="divider">·</span>
|
||||||
{% if "can_moderate_show" in show_perms %}
|
{% if "can_moderate_show" in show_perms %}
|
||||||
<a href="/show/{{show.abbr}}/submission/{{sbm.id}}/moderate" class="button modbutton"><i class="fa fa-fw fa-shield"></i> Change</a>
|
<a href="{{showurl}}/submission/{{sbm.id}}/moderate" class="button modbutton"><i class="fa fa-fw fa-shield"></i> Change</a>
|
||||||
{% else %}
|
{% else %}
|
||||||
<a href="/show/{{show.abbr}}/submission/{{sbm.id}}/report" class="report">Report Invalid or Spam</a>
|
<a href="{{showurl}}/submission/{{sbm.id}}/report" class="report">Report Invalid or Spam</a>
|
||||||
{% endif %}
|
{% endif %}
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
@ -106,9 +106,9 @@
|
|||||||
<div class="d-flex flex-row-reverse mt-4">
|
<div class="d-flex flex-row-reverse mt-4">
|
||||||
{% if user.is_authenticated %}
|
{% if user.is_authenticated %}
|
||||||
{% if "can_moderate_show" in show_perms %}
|
{% if "can_moderate_show" in show_perms %}
|
||||||
<a href="/show/{{show.abbr}}/episode/{{episode.season.number}}/{{episode.episode}}/submit" class="btn btn-warning"><i class="fa fa-fw fa-plus"></i> Add New Link</a>
|
<a href="{{showurl}}/episode/{{episode.season.number}}/{{episode.episode}}/submit" class="btn btn-warning"><i class="fa fa-fw fa-plus"></i> Add New Link</a>
|
||||||
{% else %}
|
{% else %}
|
||||||
<a href="/show/{{show.abbr}}/episode/{{episode.season.number}}/{{episode.episode}}/submit" class="btn btn-primary"><i class="fa fa-fw fa-plus"></i> Submit New Link</a>
|
<a href="{{showurl}}/episode/{{episode.season.number}}/{{episode.episode}}/submit" class="btn btn-primary"><i class="fa fa-fw fa-plus"></i> Submit New Link</a>
|
||||||
{% endif %}
|
{% endif %}
|
||||||
{% else %}
|
{% else %}
|
||||||
<span class="fillertext"><a href="/login">Log in</a> to submit a link</span>
|
<span class="fillertext"><a href="/login">Log in</a> to submit a link</span>
|
||||||
|
@ -33,7 +33,7 @@
|
|||||||
<section class="container mt-2 mb-5">
|
<section class="container mt-2 mb-5">
|
||||||
<nav aria-label="breadcrumb">
|
<nav aria-label="breadcrumb">
|
||||||
<ol class="breadcrumb">
|
<ol class="breadcrumb">
|
||||||
<li class="breadcrumb-item"><a href="/show/{{show.abbr}}">{{show.name}}</a></li>
|
<li class="breadcrumb-item"><a href="{{showurl}}">{{show.name}}</a></li>
|
||||||
<li class="breadcrumb-item active" aria-current="page">New Episode</li>
|
<li class="breadcrumb-item active" aria-current="page">New Episode</li>
|
||||||
</ol>
|
</ol>
|
||||||
</nav>
|
</nav>
|
||||||
|
@ -33,8 +33,8 @@
|
|||||||
<section class="container mb-4 mt-2">
|
<section class="container mb-4 mt-2">
|
||||||
<nav aria-label="breadcrumb">
|
<nav aria-label="breadcrumb">
|
||||||
<ol class="breadcrumb">
|
<ol class="breadcrumb">
|
||||||
<li class="breadcrumb-item"><a href="/show/{{show.abbr}}">{{show.name}}</a></li>
|
<li class="breadcrumb-item"><a href="{{showurl}}">{{show.name}}</a></li>
|
||||||
<li class="breadcrumb-item"><a href="/show/{{show.abbr}}/episode/{{episode.season.number}}/{{episode.episode}}-{{episode.name|slugify}}">{{episode.name}}</a></li>
|
<li class="breadcrumb-item"><a href="{{showurl}}/episode/{{episode.season.number}}/{{episode.episode}}-{{episode.name|slugify}}">{{episode.name}}</a></li>
|
||||||
<li class="breadcrumb-item active" aria-current="page">Report</li>
|
<li class="breadcrumb-item active" aria-current="page">Report</li>
|
||||||
</ol>
|
</ol>
|
||||||
</nav>
|
</nav>
|
||||||
|
@ -7,7 +7,7 @@
|
|||||||
<section class="container mt-5 mb-5">
|
<section class="container mt-5 mb-5">
|
||||||
<nav aria-label="breadcrumb">
|
<nav aria-label="breadcrumb">
|
||||||
<ol class="breadcrumb">
|
<ol class="breadcrumb">
|
||||||
<li class="breadcrumb-item"><a href="/show/{{show.abbr}}">{{show.name}}</a></li>
|
<li class="breadcrumb-item"><a href="{{showurl}}">{{show.name}}</a></li>
|
||||||
<li class="breadcrumb-item active" aria-current="page">New Season</li>
|
<li class="breadcrumb-item active" aria-current="page">New Season</li>
|
||||||
</ol>
|
</ol>
|
||||||
</nav>
|
</nav>
|
||||||
|
@ -41,14 +41,14 @@
|
|||||||
</div>
|
</div>
|
||||||
{% if "can_moderate_show" in show_perms %}
|
{% if "can_moderate_show" in show_perms %}
|
||||||
<div class="col-md-1 text-md-right">
|
<div class="col-md-1 text-md-right">
|
||||||
<a href="/show/{{show.abbr}}/season/{{season.number}}/append" class="action"><i class="fa fa-fw fa-plus"></i></a>
|
<a href="{{showurl}}/season/{{season.number}}/append" class="action"><i class="fa fa-fw fa-plus"></i></a>
|
||||||
</div>
|
</div>
|
||||||
{% endif %}
|
{% endif %}
|
||||||
</div>
|
</div>
|
||||||
{% endfor %}
|
{% endfor %}
|
||||||
{% if "can_moderate_show" in show_perms %}
|
{% if "can_moderate_show" in show_perms %}
|
||||||
<div class="d-flex flex-row-reverse">
|
<div class="d-flex flex-row-reverse">
|
||||||
<a href="/show/{{show.abbr}}/season/new" class="btn btn-warning"><i class="fa fa-fw fa-plus"></i> Add a Season</a>
|
<a href="{{showurl}}/season/new" class="btn btn-warning"><i class="fa fa-fw fa-plus"></i> Add a Season</a>
|
||||||
</div>
|
</div>
|
||||||
{% endif %}
|
{% endif %}
|
||||||
</section>
|
</section>
|
||||||
|
@ -33,8 +33,8 @@
|
|||||||
<section class="container mt-5 mb-5">
|
<section class="container mt-5 mb-5">
|
||||||
<nav aria-label="breadcrumb">
|
<nav aria-label="breadcrumb">
|
||||||
<ol class="breadcrumb">
|
<ol class="breadcrumb">
|
||||||
<li class="breadcrumb-item"><a href="/show/{{show.abbr}}">{{show.name}}</a></li>
|
<li class="breadcrumb-item"><a href="{{showurl}}">{{show.name}}</a></li>
|
||||||
<li class="breadcrumb-item"><a href="/show/{{show.abbr}}/episode/{{episode.season.number}}/{{episode.episode}}-{{episode.name|slugify}}">{{episode.name}}</a></li>
|
<li class="breadcrumb-item"><a href="{{showurl}}/episode/{{episode.season.number}}/{{episode.episode}}-{{episode.name|slugify}}">{{episode.name}}</a></li>
|
||||||
<li class="breadcrumb-item active" aria-current="page">Submit</li>
|
<li class="breadcrumb-item active" aria-current="page">Submit</li>
|
||||||
</ol>
|
</ol>
|
||||||
</nav>
|
</nav>
|
||||||
|
@ -35,8 +35,8 @@
|
|||||||
{% get_obj_perms request.user for show as "show_perms" %}
|
{% get_obj_perms request.user for show as "show_perms" %}
|
||||||
<nav aria-label="breadcrumb">
|
<nav aria-label="breadcrumb">
|
||||||
<ol class="breadcrumb">
|
<ol class="breadcrumb">
|
||||||
<li class="breadcrumb-item"><a href="/show/{{show.abbr}}">{{show.name}}</a></li>
|
<li class="breadcrumb-item"><a href="{{showurl}}">{{show.name}}</a></li>
|
||||||
<li class="breadcrumb-item"><a href="/show/{{show.abbr}}/episode/{{episode.season.number}}/{{episode.episode}}-{{episode.name|slugify}}">{{episode.name}}</a></li>
|
<li class="breadcrumb-item"><a href="{{showurl}}/episode/{{episode.season.number}}/{{episode.episode}}-{{episode.name|slugify}}">{{episode.name}}</a></li>
|
||||||
<li class="breadcrumb-item active" aria-current="page">Edit Submission</li>
|
<li class="breadcrumb-item active" aria-current="page">Edit Submission</li>
|
||||||
</ol>
|
</ol>
|
||||||
</nav>
|
</nav>
|
||||||
|
@ -27,6 +27,7 @@ from django.contrib.auth.mixins import LoginRequiredMixin
|
|||||||
from guardian.decorators import permission_required_or_403
|
from guardian.decorators import permission_required_or_403
|
||||||
|
|
||||||
from LandingPage.models import User, Show, Season, Episode, Submission, SubmissionVote, Ban, Report
|
from LandingPage.models import User, Show, Season, Episode, Submission, SubmissionVote, Ban, Report
|
||||||
|
from LandingPage.views import get_show_url
|
||||||
|
|
||||||
from . import forms
|
from . import forms
|
||||||
|
|
||||||
@ -50,6 +51,7 @@ class IndexView(TemplateView):
|
|||||||
# Add fields to context
|
# Add fields to context
|
||||||
ctx['show'] = show
|
ctx['show'] = show
|
||||||
ctx['seasons'] = seasons
|
ctx['seasons'] = seasons
|
||||||
|
ctx['showurl'] = get_show_url(abbr)
|
||||||
|
|
||||||
return ctx
|
return ctx
|
||||||
|
|
||||||
@ -59,6 +61,7 @@ class EpisodeView(TemplateView):
|
|||||||
|
|
||||||
def get_context_data(self, abbr, season, episode, **kwargs):
|
def get_context_data(self, abbr, season, episode, **kwargs):
|
||||||
ctx = super().get_context_data()
|
ctx = super().get_context_data()
|
||||||
|
ctx['showurl'] = get_show_url(abbr)
|
||||||
|
|
||||||
highlight = self.request.GET.get('submission', None)
|
highlight = self.request.GET.get('submission', None)
|
||||||
if not highlight == None:
|
if not highlight == None:
|
||||||
@ -93,10 +96,11 @@ class EpisodeView(TemplateView):
|
|||||||
def EpisodeFindSubmission(req, abbr, submission):
|
def EpisodeFindSubmission(req, abbr, submission):
|
||||||
show = get_object_or_404(Show, abbr=abbr)
|
show = get_object_or_404(Show, abbr=abbr)
|
||||||
submission = int(submission)
|
submission = int(submission)
|
||||||
|
showurl = get_show_url(abbr)
|
||||||
|
|
||||||
episode = get_object_or_404(Episode, submissions__id=submission)
|
episode = get_object_or_404(Episode, submissions__id=submission)
|
||||||
|
|
||||||
return HttpResponseRedirect('/show/%s/episode/%d/%d?submission=%d'%(abbr, episode.season.number, episode.episode, submission))
|
return HttpResponseRedirect('%s/episode/%d/%d?submission=%d'%(showurl, episode.season.number, episode.episode, submission))
|
||||||
|
|
||||||
# Submission form GET and POST
|
# Submission form GET and POST
|
||||||
@login_required
|
@login_required
|
||||||
@ -111,7 +115,8 @@ def SubmissionForm(req, abbr, season, episode):
|
|||||||
ctx = {
|
ctx = {
|
||||||
'form': form,
|
'form': form,
|
||||||
'show': show,
|
'show': show,
|
||||||
'episode': episode
|
'episode': episode,
|
||||||
|
'showurl': get_show_url(abbr)
|
||||||
}
|
}
|
||||||
|
|
||||||
# Get bans for this user regarding this show
|
# Get bans for this user regarding this show
|
||||||
@ -144,7 +149,7 @@ def SubmissionForm(req, abbr, season, episode):
|
|||||||
new_submission.episode = episode
|
new_submission.episode = episode
|
||||||
new_submission.save()
|
new_submission.save()
|
||||||
|
|
||||||
return HttpResponseRedirect('/show/%s/episode/%d/%d'%(abbr, episode.season.number, episode.episode))
|
return HttpResponseRedirect('%s/episode/%d/%d'%(ctx['showurl'], episode.season.number, episode.episode))
|
||||||
else:
|
else:
|
||||||
ctx['error'] = 'Invalid fields!'
|
ctx['error'] = 'Invalid fields!'
|
||||||
|
|
||||||
@ -164,18 +169,19 @@ def SubmissionModForm(req, abbr, submission):
|
|||||||
ctx = {
|
ctx = {
|
||||||
'form': form,
|
'form': form,
|
||||||
'show': show,
|
'show': show,
|
||||||
'episode': episode
|
'episode': episode,
|
||||||
|
'showurl': get_show_url(abbr)
|
||||||
}
|
}
|
||||||
|
|
||||||
# Handle POST
|
# Handle POST
|
||||||
if req.method == 'POST':
|
if req.method == 'POST':
|
||||||
if 'delete' in req.POST:
|
if 'delete' in req.POST:
|
||||||
submission.delete()
|
submission.delete()
|
||||||
return HttpResponseRedirect('/show/%s/episode/%d/%d'%(abbr, episode.season.number, episode.episode))
|
return HttpResponseRedirect('%s/episode/%d/%d'%(ctx['showurl'], episode.season.number, episode.episode))
|
||||||
|
|
||||||
if 'delete_ban' in req.POST:
|
if 'delete_ban' in req.POST:
|
||||||
submission.delete()
|
submission.delete()
|
||||||
return HttpResponseRedirect('/show/%s/create_ban?user=%s'%(abbr,submission.user.username))
|
return HttpResponseRedirect('%s/create_ban?user=%s'%(ctx['showurl'],submission.user.username))
|
||||||
|
|
||||||
form = forms.SubmissionFormAdmin(req.POST, instance=submission)
|
form = forms.SubmissionFormAdmin(req.POST, instance=submission)
|
||||||
ctx['form'] = form
|
ctx['form'] = form
|
||||||
@ -184,7 +190,7 @@ def SubmissionModForm(req, abbr, submission):
|
|||||||
form_data = form.cleaned_data
|
form_data = form.cleaned_data
|
||||||
form.save()
|
form.save()
|
||||||
|
|
||||||
return HttpResponseRedirect('/show/%s/episode/%d/%d'%(abbr, episode.season.number, episode.episode))
|
return HttpResponseRedirect('%s/episode/%d/%d'%(ctx['showurl'], episode.season.number, episode.episode))
|
||||||
else:
|
else:
|
||||||
ctx['error'] = 'Invalid fields!'
|
ctx['error'] = 'Invalid fields!'
|
||||||
|
|
||||||
@ -201,7 +207,8 @@ def SeasonSubmitForm(req, abbr):
|
|||||||
# Request context
|
# Request context
|
||||||
ctx = {
|
ctx = {
|
||||||
'form': form,
|
'form': form,
|
||||||
'show': show
|
'show': show,
|
||||||
|
'showurl': get_show_url(abbr)
|
||||||
}
|
}
|
||||||
|
|
||||||
# Handle POST
|
# Handle POST
|
||||||
@ -221,7 +228,7 @@ def SeasonSubmitForm(req, abbr):
|
|||||||
new_season.show = show
|
new_season.show = show
|
||||||
new_season.save()
|
new_season.save()
|
||||||
|
|
||||||
return HttpResponseRedirect('/show/%s'%(abbr))
|
return HttpResponseRedirect(ctx['showurl'])
|
||||||
else:
|
else:
|
||||||
ctx['error'] = 'Invalid fields!'
|
ctx['error'] = 'Invalid fields!'
|
||||||
|
|
||||||
@ -240,7 +247,8 @@ def EpisodeSubmitForm(req, abbr, season):
|
|||||||
ctx = {
|
ctx = {
|
||||||
'form': form,
|
'form': form,
|
||||||
'season': season,
|
'season': season,
|
||||||
'show': show
|
'show': show,
|
||||||
|
'showurl': get_show_url(abbr)
|
||||||
}
|
}
|
||||||
|
|
||||||
# Handle POST
|
# Handle POST
|
||||||
@ -261,7 +269,7 @@ def EpisodeSubmitForm(req, abbr, season):
|
|||||||
new_episode.season = season
|
new_episode.season = season
|
||||||
new_episode.save()
|
new_episode.save()
|
||||||
|
|
||||||
return HttpResponseRedirect('/show/%s'%(abbr))
|
return HttpResponseRedirect(ctx['showurl'])
|
||||||
else:
|
else:
|
||||||
ctx['error'] = 'Invalid fields!'
|
ctx['error'] = 'Invalid fields!'
|
||||||
|
|
||||||
@ -275,6 +283,7 @@ class SubmissionVoteSubmit(LoginRequiredMixin, View):
|
|||||||
pos_bool = int(positive) == 1
|
pos_bool = int(positive) == 1
|
||||||
|
|
||||||
user = req.user
|
user = req.user
|
||||||
|
showurl = get_show_url(abbr)
|
||||||
|
|
||||||
# Get the submission from the database
|
# Get the submission from the database
|
||||||
submission = get_object_or_404(Submission, id=subid)
|
submission = get_object_or_404(Submission, id=subid)
|
||||||
@ -307,7 +316,7 @@ class SubmissionVoteSubmit(LoginRequiredMixin, View):
|
|||||||
)
|
)
|
||||||
new_vote.save()
|
new_vote.save()
|
||||||
|
|
||||||
return HttpResponseRedirect('/show/%s/episode/%d/%d'%(abbr, submission.episode.season.number, submission.episode.episode))
|
return HttpResponseRedirect('%s/episode/%d/%d'%(showurl, submission.episode.season.number, submission.episode.episode))
|
||||||
|
|
||||||
# Episode form GET and POST
|
# Episode form GET and POST
|
||||||
@permission_required_or_403('LandingPage.can_create_show_ban', (Show, 'abbr', 'abbr'), accept_global_perms=True)
|
@permission_required_or_403('LandingPage.can_create_show_ban', (Show, 'abbr', 'abbr'), accept_global_perms=True)
|
||||||
@ -332,7 +341,8 @@ def BanFromShowForm(req, abbr):
|
|||||||
ctx = {
|
ctx = {
|
||||||
'form': form,
|
'form': form,
|
||||||
'show': show,
|
'show': show,
|
||||||
'target': banTarget
|
'target': banTarget,
|
||||||
|
'showurl': get_show_url(abbr)
|
||||||
}
|
}
|
||||||
|
|
||||||
# Handle POST
|
# Handle POST
|
||||||
@ -361,7 +371,7 @@ def BanFromShowForm(req, abbr):
|
|||||||
if 'delete' in req.POST:
|
if 'delete' in req.POST:
|
||||||
Submission.objects.filter(episode__show=show,user=banTarget).delete()
|
Submission.objects.filter(episode__show=show,user=banTarget).delete()
|
||||||
|
|
||||||
return HttpResponseRedirect('/show/%s'%(abbr))
|
return HttpResponseRedirect(ctx['showurl'])
|
||||||
else:
|
else:
|
||||||
ctx['error'] = 'Invalid fields!'
|
ctx['error'] = 'Invalid fields!'
|
||||||
|
|
||||||
@ -387,10 +397,11 @@ def ReportSubmission(req, abbr, submission):
|
|||||||
'form': form,
|
'form': form,
|
||||||
'show': show,
|
'show': show,
|
||||||
'episode': episode,
|
'episode': episode,
|
||||||
'submission': submission
|
'submission': submission,
|
||||||
|
'showurl': get_show_url(abbr)
|
||||||
}
|
}
|
||||||
|
|
||||||
url = '/show/%s/episode/%d/%d?submission=%s'%(abbr, episode.season.number, episode.episode,submission.pk)
|
url = '%s/episode/%d/%d?submission=%s'%(ctx['showurl'], episode.season.number, episode.episode,submission.pk)
|
||||||
|
|
||||||
# Handle POST
|
# Handle POST
|
||||||
if req.method == 'POST':
|
if req.method == 'POST':
|
||||||
@ -416,7 +427,7 @@ def ReportSubmission(req, abbr, submission):
|
|||||||
new_report.url = url
|
new_report.url = url
|
||||||
new_report.save()
|
new_report.save()
|
||||||
|
|
||||||
return HttpResponseRedirect('/show/%s/episode/%d/%d'%(abbr, episode.season.number, episode.episode))
|
return HttpResponseRedirect('%s/episode/%d/%d'%(ctx['showurl'], episode.season.number, episode.episode))
|
||||||
else:
|
else:
|
||||||
ctx['error'] = 'Invalid fields!'
|
ctx['error'] = 'Invalid fields!'
|
||||||
|
|
||||||
|
Reference in New Issue
Block a user