From 05a5d7d956b6c0569a2a88304373e4f06cb382e3 Mon Sep 17 00:00:00 2001 From: Jorran de Wit <jorrandewit@outlook.com> Date: Mon, 27 Mar 2017 22:49:57 +0200 Subject: [PATCH] Extend/Enrich Admin views --- commentaries/admin.py | 3 +++ scipost/feeds.py | 1 + .../feeds/latest_publications_title.html | 2 +- submissions/admin.py | 21 ++++++++++++++++++- .../submissions/_submission_status_block.html | 2 +- 5 files changed, 26 insertions(+), 3 deletions(-) diff --git a/commentaries/admin.py b/commentaries/admin.py index b21786c85..80f638be8 100644 --- a/commentaries/admin.py +++ b/commentaries/admin.py @@ -5,5 +5,8 @@ from commentaries.models import Commentary class CommentaryAdmin(admin.ModelAdmin): search_fields = ['author_list', 'pub_abstract'] + list_display = ('__str__', 'vetted', 'latest_activity',) + date_hierarchy = 'latest_activity' + admin.site.register(Commentary, CommentaryAdmin) diff --git a/scipost/feeds.py b/scipost/feeds.py index 6edb9e1b7..8397cb637 100644 --- a/scipost/feeds.py +++ b/scipost/feeds.py @@ -41,6 +41,7 @@ class LatestCommentsFeedRSS(Feed): else: return reverse('scipost:index') + class LatestCommentsFeedAtom(LatestCommentsFeedRSS): feed_type = Atom1Feed subtitle = LatestCommentsFeedRSS.description diff --git a/scipost/templates/feeds/latest_publications_title.html b/scipost/templates/feeds/latest_publications_title.html index 68a1f74fe..803096e51 100644 --- a/scipost/templates/feeds/latest_publications_title.html +++ b/scipost/templates/feeds/latest_publications_title.html @@ -1 +1 @@ -{{ obj.citation_for_web }}, by {{ obj.author_list }} +{{obj.in_issue.in_volume.in_journal.get_abbreviation_citation}} <strong>{{obj.in_issue.in_volume.number}}</strong>, {{obj.get_paper_nr}} ({{obj.publication_date|date:'Y'}}), by {{ obj.author_list }} diff --git a/submissions/admin.py b/submissions/admin.py index 94b61885e..1415e4438 100644 --- a/submissions/admin.py +++ b/submissions/admin.py @@ -5,14 +5,26 @@ from guardian.admin import GuardedModelAdmin from submissions.models import * +def submission_short_title(obj): + return obj.submission.title[:30] + + class SubmissionAdmin(GuardedModelAdmin): search_fields = ['submitted_by__user__last_name', 'title', 'author_list', 'abstract'] + list_display = ('title', 'author_list', 'status', 'submission_date', 'publication',) + date_hierarchy = 'submission_date' + list_filter = ('status', 'discipline', 'submission_type', ) + admin.site.register(Submission, SubmissionAdmin) class EditorialAssignmentAdmin(admin.ModelAdmin): search_fields = ['submission__title', 'submission__author_list', 'to__user__last_name'] + list_display = ('to', submission_short_title, 'accepted', 'completed', 'date_created',) + date_hierarchy = 'date_created' + list_filter = ('accepted', 'deprecated', 'completed', ) + admin.site.register(EditorialAssignment, EditorialAssignmentAdmin) @@ -27,7 +39,12 @@ admin.site.register(RefereeInvitation, RefereeInvitationAdmin) class ReportAdmin(admin.ModelAdmin): - search_fields = ['author__user__last_name'] + search_fields = ['author__user__last_name', 'submission'] + list_display = ('author', 'status', submission_short_title, 'date_submitted', ) + list_display_links = ('author',) + date_hierarchy = 'date_submitted' + list_filter = ('status',) + admin.site.register(Report, ReportAdmin) @@ -35,10 +52,12 @@ admin.site.register(Report, ReportAdmin) class EditorialCommunicationAdmin(admin.ModelAdmin): search_fields = ['submission__title', 'referee__user__last_name', 'text'] + admin.site.register(EditorialCommunication, EditorialCommunicationAdmin) class EICRecommendationAdmin(admin.ModelAdmin): search_fields = ['submission__title'] + admin.site.register(EICRecommendation, EICRecommendationAdmin) diff --git a/submissions/templates/submissions/_submission_status_block.html b/submissions/templates/submissions/_submission_status_block.html index 3229f263d..28aa0b472 100644 --- a/submissions/templates/submissions/_submission_status_block.html +++ b/submissions/templates/submissions/_submission_status_block.html @@ -2,6 +2,6 @@ <div class="d-inline"> <span class="label label-secondary">{{submission.get_status_display}}</span> {% if submission.publication %} - as {{submission.publication.citation_for_web_linked}} + as <a href="{% url 'scipost:publication_detail' submission.publication.doi_string %}">{{submission.publication.in_issue.in_volume.in_journal.get_abbreviation_citation}} <strong>{{submission.publication.in_issue.in_volume.number}}</strong>, {{submission.publication.get_paper_nr}} ({{submission.publication.publication_date|date:'Y'}})</a> {% endif %} </div> -- GitLab