From 0e32b1f019af09797cbf44e4fe37c2ef42a205ef Mon Sep 17 00:00:00 2001
From: "J.-S. Caux" <J.S.Caux@uva.nl>
Date: Wed, 16 Mar 2016 08:31:53 +0100
Subject: [PATCH] Use generic views in all other apps

---
 commentaries/urls.py  |  7 +++----
 commentaries/views.py |  7 -------
 comments/urls.py      |  5 ++---
 comments/views.py     |  9 ---------
 ratings/urls.py       | 13 +++++++------
 ratings/views.py      | 18 ------------------
 submissions/urls.py   |  9 ++++-----
 submissions/views.py  | 13 -------------
 theses/urls.py        |  2 +-
 theses/views.py       |  4 ----
 10 files changed, 17 insertions(+), 70 deletions(-)

diff --git a/commentaries/urls.py b/commentaries/urls.py
index 09adf1c9b..32a7e8861 100644
--- a/commentaries/urls.py
+++ b/commentaries/urls.py
@@ -1,4 +1,5 @@
 from django.conf.urls import include, url
+from django.views.generic import TemplateView 
 
 from . import views
 
@@ -6,12 +7,10 @@ urlpatterns = [
     # Commentaries
     url(r'^$', views.commentaries, name='commentaries'),
     url(r'^browse/(?P<discipline>[a-z]+)/(?P<nrweeksback>[0-9]+)/$', views.browse, name='browse'),
-    #url(r'^(?P<discipline>[a-z]+)/(?P<nrweeksback>[0-9]+)/$', views.browse),
-    url(r'^howto$', views.howto, name='howto'),
+    url(r'^howto$', TemplateView.as_view(template_name='commentaries/howto.html'), name='howto'),
     url(r'^commentary/(?P<commentary_id>[0-9]+)/$', views.commentary_detail, name='commentary'),
     url(r'^request_commentary$', views.request_commentary, name='request_commentary'),
-    url(r'^request_commentary_ack$', views.request_commentary_ack, name='request_commentary_ack'),
+    url(r'^request_commentary_ack$', TemplateView.as_view(template_name='commentaries/request_commentary_ack.html'), name='request_commentary_ack'),
     url(r'^vet_commentary_requests$', views.vet_commentary_requests, name='vet_commentary_requests'),
-    #url(r'^no_commentary_req_to_vet$', views.no_commentary_req_to_vet, name='no_commentary_req_to_vet'),
     url(r'^vet_commentary_request_ack/(?P<commentary_id>[0-9]+)$', views.vet_commentary_request_ack, name='vet_commentary_request_ack'),
 ]
diff --git a/commentaries/views.py b/commentaries/views.py
index 6163a6628..007e73c78 100644
--- a/commentaries/views.py
+++ b/commentaries/views.py
@@ -24,9 +24,6 @@ title_dict = dict(TITLE_CHOICES) # Convert titles for use in emails
 ################
 
 
-def howto(request):
-    return render(request, 'commentaries/howto.html')
-
 def request_commentary(request):
     # commentary pages can only be requested by registered contributors:
     if request.user.is_authenticated():
@@ -58,10 +55,6 @@ def request_commentary(request):
         return render(request, 'scipost/login.html', {'form': form})
 
 
-def request_commentary_ack(request):
-    return render(request, 'commentaries/request_commentary_ack.html')
-
-
 def vet_commentary_requests(request):
     contributor = Contributor.objects.get(user=request.user)
     commentary_to_vet = Commentary.objects.filter(vetted=False).first() # only handle one at a time
diff --git a/comments/urls.py b/comments/urls.py
index ce491bc56..9312a6e2f 100644
--- a/comments/urls.py
+++ b/comments/urls.py
@@ -1,17 +1,16 @@
 from django.conf.urls import include, url
+from django.views.generic import TemplateView
 
 from . import views
 
 urlpatterns = [
     # Comments
-    url(r'^comment_submission_ack$', views.comment_submission_ack, name='comment_submission_ack'),
+    url(r'^comment_submission_ack$', TemplateView.as_view(template_name='comments/comment_submission_ack.html'), name='comment_submission_ack'),
     url(r'^reply_to_comment/(?P<comment_id>[0-9]+)$', views.reply_to_comment, name='reply_to_comment'),
     url(r'^vet_submitted_comments$', views.vet_submitted_comments, name='vet_submitted_comments'),
-    #url(r'^no_comment_to_vet$', views.no_comment_to_vet, name='no_comment_to_vet'),
     url(r'^vet_submitted_comment_ack/(?P<comment_id>[0-9]+)$', views.vet_submitted_comment_ack, name='vet_submitted_comment_ack'),
     url(r'^author_reply_to_comment/(?P<comment_id>[0-9]+)$', views.author_reply_to_comment, name='author_reply_to_comment'),
     url(r'^author_reply_to_report/(?P<report_id>[0-9]+)$', views.author_reply_to_report, name='author_reply_to_report'),
     url(r'^vet_author_replies$', views.vet_author_replies, name='vet_author_replies'),
-    #url(r'^no_author_reply_to_vet$', views.no_author_reply_to_vet, name='no_author_reply_to_vet'),
     url(r'^vet_author_reply_ack/(?P<reply_id>[0-9]+)$', views.vet_author_reply_ack, name='vet_author_reply_ack'),
 ]
diff --git a/comments/views.py b/comments/views.py
index 9da2105f8..3ef5f0458 100644
--- a/comments/views.py
+++ b/comments/views.py
@@ -16,10 +16,6 @@ from .forms import *
 from scipost.models import title_dict
 
 
-def comment_submission_ack(request):
-    return render(request, 'comments/comment_submission_ack.html')
-
-
 def vet_submitted_comments(request):
     contributor = Contributor.objects.get(user=request.user)
     comment_to_vet = Comment.objects.filter(status=0).first() # only handle one at a time
@@ -27,11 +23,6 @@ def vet_submitted_comments(request):
     form = VetCommentForm()
     context = {'contributor': contributor, 'comment_to_vet': comment_to_vet, 'form': form }
     return(render(request, 'comments/vet_submitted_comments.html', context))
-    #return render (request, 'comments/no_comment_to_vet.html')
-
-
-#def no_comment_to_vet(request):
-#    return render (request, 'comments/no_comment_to_vet.html')
 
 
 def vet_submitted_comment_ack(request, comment_id):
diff --git a/ratings/urls.py b/ratings/urls.py
index fe096bbb3..de1e0626a 100644
--- a/ratings/urls.py
+++ b/ratings/urls.py
@@ -1,18 +1,19 @@
 from django.conf.urls import include, url
+from django.views.generic import TemplateVie
 
 from . import views
 
 urlpatterns = [
     url(r'^vote_on_submission/(?P<submission_id>[0-9]+)$', views.vote_on_submission, name='vote_on_submission'),
-    url(r'^vote_on_submission_ack$', views.vote_on_submission_ack, name='vote_on_submission_ack'),
+    url(r'^vote_on_submission_ack$', TemplateView.as_view(template_name='ratings/vote_on_submission_ack.html'), name='vote_on_submission_ack'),
     url(r'^vote_on_report/(?P<report_id>[0-9]+)$', views.vote_on_report, name='vote_on_report'),
-    url(r'^vote_on_report_ack$', views.vote_on_report_ack, name='vote_on_report_ack'),
+    url(r'^vote_on_report_ack$', TemplateView.as_view(template_name='ratings/vote_on_report_ack.html'), name='vote_on_report_ack'),
     url(r'^vote_on_commentary/(?P<commentary_id>[0-9]+)$', views.vote_on_commentary, name='vote_on_commentary'),
-    url(r'^vote_on_commentary_ack$', views.vote_on_commentary_ack, name='vote_on_commentary_ack'),
+    url(r'^vote_on_commentary_ack$', TemplateView.as_view(template_name='ratings/vote_on_commentary_ack.html'), name='vote_on_commentary_ack'),
     url(r'^vote_on_thesis/(?P<thesislink_id>[0-9]+)$', views.vote_on_thesis, name='vote_on_thesis'),
-    url(r'^vote_on_thesis_ack$', views.vote_on_thesis_ack, name='vote_on_thesis_ack'),
+    url(r'^vote_on_thesis_ack$', TemplateView.as_view(template_name='ratings/vote_on_thesis_ack.html'), name='vote_on_thesis_ack'),
     url(r'^vote_on_comment/(?P<comment_id>[0-9]+)$', views.vote_on_comment, name='vote_on_comment'),
-    url(r'^vote_on_comment_ack$', views.vote_on_comment_ack, name='vote_on_comment_ack'),
+    url(r'^vote_on_comment_ack$', TemplateView.as_view(template_name='ratings/vote_on_comment_ack.html'), name='vote_on_comment_ack'),
     url(r'^vote_on_authorreply/(?P<authorreply_id>[0-9]+)$', views.vote_on_authorreply, name='vote_on_authorreply'),
-    url(r'^vote_on_authorreply_ack$', views.vote_on_authorreply_ack, name='vote_on_authorreply_ack'),
+    url(r'^vote_on_authorreply_ack$', TemplateView.as_view(template_name='ratings/vote_on_authorreply_ack;html'), name='vote_on_authorreply_ack'),
 ]
diff --git a/ratings/views.py b/ratings/views.py
index 00dae1c2b..b796dcb2b 100644
--- a/ratings/views.py
+++ b/ratings/views.py
@@ -51,10 +51,6 @@ def vote_on_commentary(request, commentary_id):
     context = {'commentary_id': commentary_id}
     return render(request, 'ratings/vote_on_commentary_ack.html', context)
             
-def vote_on_commentary_ack(request):
-    context = {}
-    return render(request, 'ratings/vote_on_commentary_ack.html', context)
-
 
 
 def vote_on_comment(request, comment_id):
@@ -146,10 +142,6 @@ def vote_on_comment(request, comment_id):
     return render(request, 'ratings/vote_on_comment_ack.html')
 
 
-def vote_on_comment_ack(request):
-    context = {}
-    return render(request, 'ratings/vote_on_comment_ack.html', context)
-
 
 def vote_on_authorreply(request, authorreply_id):
     authorreply = get_object_or_404(AuthorReply, pk=authorreply_id)
@@ -240,11 +232,6 @@ def vote_on_authorreply(request, authorreply_id):
     return render(request, 'ratings/vote_on_authorreply_ack.html')
 
 
-def vote_on_authorreply_ack(request):
-    context = {}
-    return render(request, 'ratings/vote_on_authorreply_ack.html', context)
-
-
 
 def vote_on_report(request, report_id):
     report = get_object_or_404(Report, pk=report_id)
@@ -332,11 +319,6 @@ def vote_on_report(request, report_id):
 
     return render(request, 'ratings/vote_on_report_ack.html')
             
-def vote_on_report_ack(request):
-    context = {}
-    return render(request, 'ratings/vote_on_report_ack.html', context)
-
-
 
 
 def vote_on_submission(request, submission_id):
diff --git a/submissions/urls.py b/submissions/urls.py
index 34e3d524d..f426b1351 100644
--- a/submissions/urls.py
+++ b/submissions/urls.py
@@ -1,4 +1,5 @@
 from django.conf.urls import include, url
+from django.views.generic import TemplateView
 
 from . import views
 
@@ -6,17 +7,15 @@ urlpatterns = [
     # Submissions
     url(r'^$', views.submissions, name='submissions'),
     url(r'^browse/(?P<discipline>[a-z]+)/(?P<nrweeksback>[0-9]+)/$', views.browse, name='browse'),
-    url(r'^sub_and_ref_procedure$', views.sub_and_ref_procedure, name='sub_and_ref_procedure'),
+    url(r'^sub_and_ref_procedure$', TemplateView.as_view(template_name='submissions/sub_and_ref_procedure.html'), name='sub_and_ref_procedure'),
     url(r'^submission/(?P<submission_id>[0-9]+)/$', views.submission_detail, name='submission'),
     url(r'^submit_manuscript$', views.submit_manuscript, name='submit_manuscript'),
-    url(r'^submit_manuscript_ack$', views.submit_manuscript_ack, name='submit_manuscript_ack'),
+    url(r'^submit_manuscript_ack$', TemplateView.as_view(template_name='submissions/submit_manuscript_ack.html'), name='submit_manuscript_ack'),
     url(r'^process_new_submissions$', views.process_new_submissions, name='process_new_submissions'),
-    #url(r'^no_new_submission_to_process$', views.no_new_submission_to_process, name='no_new_submission_to_process'),
     url(r'^process_new_submission_ack/(?P<submission_id>[0-9]+)$', views.process_new_submission_ack, name='process_new_submission_ack'),
     # Reports
     url(r'^submit_report/(?P<submission_id>[0-9]+)$', views.submit_report, name='submit_report'),
-    url(r'^submit_report_ack$', views.submit_report_ack, name='submit_report_ack'),
+    url(r'^submit_report_ack$', TemplateView.as_view(template_name='submissions/submit_report_ack.html'), name='submit_report_ack'),
     url(r'^vet_submitted_reports$', views.vet_submitted_reports, name='vet_submitted_reports'),
-    #url(r'^no_report_to_vet$', views.no_report_to_vet, name='no_report_to_vet'),
     url(r'^vet_submitted_report_ack/(?P<report_id>[0-9]+)$', views.vet_submitted_report_ack, name='vet_submitted_report_ack'),
 ]
diff --git a/submissions/views.py b/submissions/views.py
index 7a152c1db..2252f3c68 100644
--- a/submissions/views.py
+++ b/submissions/views.py
@@ -25,10 +25,6 @@ from ratings.forms import CommentRatingForm, AuthorReplyRatingForm, ReportRating
 # SUBMISSIONS:
 ###############
 
-def sub_and_ref_procedure(request):
-    return render(request, 'submissions/sub_and_ref_procedure.html')
-
-
 def submit_manuscript(request):
     if request.method == 'POST':
         form = SubmissionForm(request.POST)
@@ -54,10 +50,6 @@ def submit_manuscript(request):
     return render(request, 'submissions/submit_manuscript.html', {'form': form})
 
 
-def submit_manuscript_ack(request):
-    return render(request, 'submissions/submit_manuscript_ack.html')
-
-
 def process_new_submissions(request):
     submission_to_process = Submission.objects.filter(status='unassigned').first() # only handle one at at time
     form = ProcessSubmissionForm()
@@ -205,11 +197,6 @@ def submit_report(request, submission_id):
     return render(request, 'submissions/submit_report.html', context)
 
 
-def submit_report_ack(request):
-    context = {}
-    return render(request, 'submissions/submit_report_ack.html', context)
-
-
 def vet_submitted_reports(request):
     contributor = Contributor.objects.get(user=request.user)
     report_to_vet = Report.objects.filter(status=0).first() # only handle one at a time
diff --git a/theses/urls.py b/theses/urls.py
index 5ca6c0119..f6b015135 100644
--- a/theses/urls.py
+++ b/theses/urls.py
@@ -8,7 +8,7 @@ urlpatterns = [
     url(r'^browse/(?P<discipline>[a-z]+)/(?P<nrweeksback>[0-9]+)/$', views.browse, name='browse'),
     url(r'^thesis/(?P<thesislink_id>[0-9]+)/$', views.thesis_detail, name='thesis'),
     url(r'^request_thesislink$', views.request_thesislink, name='request_thesislink'),
-    url(r'^request_thesislink_ack$', views.request_thesislink_ack, name='request_thesislink_ack'),
+    url(r'^request_thesislink_ack$', TemplateView.as_view(template_name='theses/request_thesislink_ack.html'), name='request_thesislink_ack'),
     url(r'^vet_thesislink_requests$', views.vet_thesislink_requests, name='vet_thesislink_requests'),
     url(r'^vet_thesislink_request_ack/(?P<thesislink_id>[0-9]+)$', views.vet_thesislink_request_ack, name='vet_thesislink_request_ack'),
 ]
diff --git a/theses/views.py b/theses/views.py
index 788ba3ef1..bd3313fb6 100644
--- a/theses/views.py
+++ b/theses/views.py
@@ -56,10 +56,6 @@ def request_thesislink(request):
         return render(request, 'scipost/login.html', {'form': form})
 
 
-def request_thesislink_ack(request):
-    return render(request, 'theses/request_thesislink_ack.html')
-
-
 def vet_thesislink_requests(request):
     contributor = Contributor.objects.get(user=request.user)
     thesislink_to_vet = ThesisLink.objects.filter(vetted=False).first() # only handle one at a time
-- 
GitLab