Commit da82bddd authored by Evert Prants's avatar Evert Prants

Add URL to find episode by submission ID

parent 7481f245
......@@ -41,6 +41,7 @@ urlpatterns = [
url(r'^season/(?P<season>\d{1,4})/append$', views.EpisodeSubmitForm),
url(r'^submission/(?P<submission>\d{1,4})/moderate$', views.SubmissionModForm),
url(r'^submission/(?P<submission>\d{1,4})/report$', views.ReportSubmission),
url(r'^episode/by-submission/(?P<submission>\d{1,4})$', views.EpisodeFindSubmission),
url(r'^episode/(?P<season>\d{1,4})/(?P<episode>\d{1,4})(-[\w-]+)?/?$', views.EpisodeView.as_view()),
url(r'^episode/(?P<season>\d{1,4})/(?P<episode>\d{1,4})(-[\w-]+)?/submit$', views.SubmissionForm),
url(r'^vote/(?P<subid>\d+)/(?P<positive>[0-1])/?$', views.SubmissionVoteSubmit.as_view())
......
......@@ -90,6 +90,14 @@ class EpisodeView(TemplateView):
return ctx
def EpisodeFindSubmission(req, abbr, submission):
show = get_object_or_404(Show, abbr=abbr)
submission = int(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))
# Submission form GET and POST
@login_required
def SubmissionForm(req, abbr, season, episode):
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment