diff --git a/Show/urls.py b/Show/urls.py index 1d7c54f..62b6e69 100644 --- a/Show/urls.py +++ b/Show/urls.py @@ -41,6 +41,7 @@ urlpatterns = [ url(r'^season/(?P\d{1,4})/append$', views.EpisodeSubmitForm), url(r'^submission/(?P\d{1,4})/moderate$', views.SubmissionModForm), url(r'^submission/(?P\d{1,4})/report$', views.ReportSubmission), + url(r'^episode/by-submission/(?P\d{1,4})$', views.EpisodeFindSubmission), url(r'^episode/(?P\d{1,4})/(?P\d{1,4})(-[\w-]+)?/?$', views.EpisodeView.as_view()), url(r'^episode/(?P\d{1,4})/(?P\d{1,4})(-[\w-]+)?/submit$', views.SubmissionForm), url(r'^vote/(?P\d+)/(?P[0-1])/?$', views.SubmissionVoteSubmit.as_view()) diff --git a/Show/views.py b/Show/views.py index 9f205cc..cbff335 100644 --- a/Show/views.py +++ b/Show/views.py @@ -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):