From 24060a0fe54bd14ff9df9f6ec51b0cd6aaadc66d Mon Sep 17 00:00:00 2001 From: "J.-S. Caux" <J.S.Caux@uva.nl> Date: Wed, 14 Sep 2016 16:43:02 +0200 Subject: [PATCH] Add links with doi_label --- journals/utils.py | 4 +++- journals/views.py | 14 ++++++++++++++ scipost/urls.py | 6 ++++++ 3 files changed, 23 insertions(+), 1 deletion(-) diff --git a/journals/utils.py b/journals/utils.py index f5c8f4c27..879d0f8bc 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 74a20ace3..d41e13471 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 79195b2bf..b3331e808 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'), ######### -- GitLab