diff --git a/journals/utils.py b/journals/utils.py index f5c8f4c275b81797f67191fdf793a7194a032388..879d0f8bc18f47bfe46b57e7c961be499b3d3008 100644 --- a/journals/utils.py +++ b/journals/utils.py @@ -17,13 +17,15 @@ class JournalUtils(object): + title_dict[cls.publication.accepted_submission.submitted_by.title] + ' ' + cls.publication.accepted_submission.submitted_by.user.last_name + - ', \n\nWe have happy to inform you that your Submission to SciPost,\n\n' + + ', \n\nWe are happy to inform you that your Submission to SciPost,\n\n' + cls.publication.accepted_submission.title + ' by ' + cls.publication.accepted_submission.author_list + '\n\nhas been published online with reference ' + cls.publication.citation() + '.' '\n\nThe publication page is located at the permanent link ' 'https://scipost.org/' + cls.publication.doi_string + '.' + '\n\nTo facilitate dissemination of your paper, we greatly encourage ' + 'you to update the arXiv Journal-ref with this information.' '\n\nWe warmly congratulate you on this achievement and thank you ' 'for entrusting us with the task of publishing your research. ' '\n\nSincerely,' + diff --git a/journals/views.py b/journals/views.py index 74a20ace3894f040e8e1179ae88527786ef55749..d41e134719d4f20d92719fa8a14bf1f8834f43c3 100644 --- a/journals/views.py +++ b/journals/views.py @@ -292,3 +292,17 @@ def publication_pdf(request, doi_string): response['Content-Disposition'] = ('filename=' + publication.doi_label.replace('.', '_') + '.pdf') return response + +def publication_detail_form_doi_label(request, doi_label): + publication = get_object_or_404 (Publication, doi_label=doi_label) + context = {'publication': publication,} + return render(request, 'journals/publication_detail.html', context) + + +def publication_pdf_from_doi_label(request, doi_label): + publication = get_object_or_404 (Publication, doi_label=doi_label) + pdf = File(publication.pdf_file) + response = HttpResponse(pdf, content_type='application/pdf') + response['Content-Disposition'] = ('filename=' + + publication.doi_label.replace('.', '_') + '.pdf') + return response diff --git a/scipost/urls.py b/scipost/urls.py index 79195b2bfa060410bc1450363912244d764792de..b3331e80844d800c3ca1f5d81efdfb40fc3efa9c 100644 --- a/scipost/urls.py +++ b/scipost/urls.py @@ -90,6 +90,12 @@ urlpatterns = [ url(r'^(?P<doi_string>10.21468/[a-zA-Z]+.[0-9]+.[0-9]+.[0-9]{3,})/pdf$', journals_views.publication_pdf, name='publication_pdf'), + url(r'^(?P<doi_label>[a-zA-Z]+.[0-9]+.[0-9]+.[0-9]{3,})$', + journals_views.publication_detail_form_doi_label, + name='publication_detail_from_doi_label'), + url(r'^(?P<doi_label>[a-zA-Z]+.[0-9]+.[0-9]+.[0-9]{3,})/pdf$', + journals_views.publication_pdf_from_doi_label, + name='publication_pdf_from_doi_label'), #########