Fix WrongAppError

This commit is contained in:
Evert Prants 2017-12-26 19:34:24 +02:00
parent 48a037439e
commit 45785c9e51
Signed by: evert
GPG Key ID: 1688DA83D222D0B5

View File

@ -100,7 +100,7 @@ def SubmissionForm(req, abbr, season, episode):
ctx['error'] = 'This URL has already been submitted!' ctx['error'] = 'This URL has already been submitted!'
return render(req, "submit.html", ctx) return render(req, "submit.html", ctx)
if not user.has_perm('show.change_show'): if not user.has_perm('LandingPage.change_show'):
# Check if there has been a submission by this user for this episode within the last 24 hours # Check if there has been a submission by this user for this episode within the last 24 hours
if Submission.objects.filter(user=user,episode=episode,timestamp__gte=datetime.datetime.now() - datetime.timedelta(hours=24)).count() > 0: if Submission.objects.filter(user=user,episode=episode,timestamp__gte=datetime.datetime.now() - datetime.timedelta(hours=24)).count() > 0:
ctx['error'] = 'You can only submit one link for an episode in 24 hours!' ctx['error'] = 'You can only submit one link for an episode in 24 hours!'
@ -118,7 +118,7 @@ def SubmissionForm(req, abbr, season, episode):
return render(req, "submit.html", ctx) return render(req, "submit.html", ctx)
# Edit a submission - for moderators # Edit a submission - for moderators
@permission_required_or_403('show.change_show', (Show, 'abbr', 'abbr'), accept_global_perms=True) @permission_required_or_403('LandingPage.change_show', (Show, 'abbr', 'abbr'), accept_global_perms=True)
def SubmissionModForm(req, abbr, submission): def SubmissionModForm(req, abbr, submission):
show = get_object_or_404(Show, abbr=abbr) show = get_object_or_404(Show, abbr=abbr)
submission = get_object_or_404(Submission, pk=submission) submission = get_object_or_404(Submission, pk=submission)
@ -159,7 +159,7 @@ def SubmissionModForm(req, abbr, submission):
return render(req, "submit_mod.html", ctx) return render(req, "submit_mod.html", ctx)
# Season form GET and POST # Season form GET and POST
@permission_required_or_403('show.change_show', (Show, 'abbr', 'abbr'), accept_global_perms=True) @permission_required_or_403('LandingPage.change_show', (Show, 'abbr', 'abbr'), accept_global_perms=True)
def SeasonSubmitForm(req, abbr): def SeasonSubmitForm(req, abbr):
show = get_object_or_404(Show, abbr=abbr) show = get_object_or_404(Show, abbr=abbr)
user = req.user user = req.user
@ -196,7 +196,7 @@ def SeasonSubmitForm(req, abbr):
return render(req, "season_add.html", ctx) return render(req, "season_add.html", ctx)
# Episode form GET and POST # Episode form GET and POST
@permission_required_or_403('show.change_show', (Show, 'abbr', 'abbr'), accept_global_perms=True) @permission_required_or_403('LandingPage.change_show', (Show, 'abbr', 'abbr'), accept_global_perms=True)
def EpisodeSubmitForm(req, abbr, season): def EpisodeSubmitForm(req, abbr, season):
show = get_object_or_404(Show, abbr=abbr) show = get_object_or_404(Show, abbr=abbr)
season = get_object_or_404(Season, show=show,number=season) season = get_object_or_404(Season, show=show,number=season)