diff --git a/ontology/models.py b/ontology/models.py index 662e140486c77674a32781d23d598c4f6177f74d..c429495c82b1b14822d30ab78d12912be403aa48 100644 --- a/ontology/models.py +++ b/ontology/models.py @@ -3,6 +3,7 @@ __license__ = "AGPL v3" from django.db import models +from django.urls import reverse from .constants import TOPIC_RELATIONS_ASYM, TOPIC_RELATIONS_SYM @@ -27,7 +28,7 @@ class Topic(models.Model): """ name = models.CharField(max_length=256, unique=True) slug = models.SlugField(unique=True, allow_unicode=True) - tags = models.ManyToManyField(Tag, blank=True) + tags = models.ManyToManyField('ontology.Tag', blank=True) class Meta: ordering = ['name'] @@ -61,8 +62,6 @@ class RelationSym(models.Model): relation = models.CharField(max_length=32, choices=TOPIC_RELATIONS_SYM) def __str__(self): - text = '' - for topic in self.topics.all(): - text += '%s, ' % topic + text = ', '.join(self.topics.values_list('name', flat=True)) text += self.get_relation_display() return text diff --git a/ontology/templates/ontology/_topic_card.html b/ontology/templates/ontology/_topic_card.html index ff13e915346e10b09ce3f1a77ce86aa1069bf9d1..0caa74a2160923bd095a6328365fef773b921cbd 100644 --- a/ontology/templates/ontology/_topic_card.html +++ b/ontology/templates/ontology/_topic_card.html @@ -103,16 +103,12 @@ </div> <div class="card-body"> <ul> - {% for sub in topic.submission_set.public_newest %} - {% if not sub.publication and not sub.publication.is_published %} - <li> - <a href="{{ sub.get_absolute_url }}">{{ sub.title }}</a> - <br>by {{ sub.author_list }} - <br>(submitted {{ sub.submission_date|date:"Y-m-d" }} to {{ sub.get_submitted_to_journal_display }}) - </li> - {% else %} - <li>No Submission found</li> - {% endif %} + {% for sub in topic.submission_set.unpublished.public_newest %} + <li> + <a href="{{ sub.get_absolute_url }}">{{ sub.title }}</a> + <br>by {{ sub.author_list }} + <br>(submitted {{ sub.submission_date|date:"Y-m-d" }} to {{ sub.get_submitted_to_journal_display }}) + </li> {% empty %} <li>No Submission found</li> {% endfor %} diff --git a/ontology/templates/ontology/ontology.html b/ontology/templates/ontology/ontology.html index 7f88184d88eefcd506798633704a0dc37c7549ed..4f78199e086e70c04d82847b77f14f8d5c1fa8c7 100644 --- a/ontology/templates/ontology/ontology.html +++ b/ontology/templates/ontology/ontology.html @@ -27,11 +27,11 @@ Topics and their relations are defined by Editorial-level personnel. The ontology is used at many levels within SciPost, including but not limited to: <ul> - <li>identifying the best potential Editors-in-charge for incoming submissions</li> - <li>identifying thematic areas for which the editorial workforce should be increased</li> - <li>providing Editors-in-charge with referee suggestions</li> - <li>giving readers a way to identify interesting published content</li> - <li>assisting our internal metadata- and content-driven engines.</li> + <li>identifying the best potential Editors-in-charge for incoming submissions</li> + <li>identifying thematic areas for which the editorial workforce should be increased</li> + <li>providing Editors-in-charge with referee suggestions</li> + <li>giving readers a way to identify interesting published content</li> + <li>assisting our internal metadata- and content-driven engines.</li> </ul> </p> <p> diff --git a/ontology/views.py b/ontology/views.py index 06eaae5e22c64e27d9995b5684b9dbc87d81b49e..b5fbbb88c37fb08612b5fabc53b41916eeb94ffe 100644 --- a/ontology/views.py +++ b/ontology/views.py @@ -5,7 +5,6 @@ __license__ = "AGPL v3" from django.contrib import messages from django.core.urlresolvers import reverse, reverse_lazy from django.db.models import Q -from django.http import HttpResponse, HttpResponseServerError from django.shortcuts import get_object_or_404, redirect, render from django.views.generic.detail import DetailView from django.views.generic.edit import CreateView, UpdateView @@ -13,7 +12,7 @@ from django.views.generic.list import ListView from guardian.decorators import permission_required -from .models import Tag, Topic, RelationAsym, RelationSym +from .models import Tag, Topic, RelationAsym from .forms import SelectTagForm, SelectLinkedTopicForm, AddRelationAsymForm from scipost.forms import SearchTextForm diff --git a/submissions/managers.py b/submissions/managers.py index b723bdb6d61f8c9e28df9581f5a3f98c00d63d83..edb98934913597f183e1c515ae3d331bbcb0f8cf 100644 --- a/submissions/managers.py +++ b/submissions/managers.py @@ -177,6 +177,10 @@ class SubmissionQuerySet(models.QuerySet): """Return published Submissions.""" return self.filter(status=constants.STATUS_PUBLISHED) + def unpublished(self): + """Return unpublished Submissions.""" + return self.exclude(status=constants.STATUS_PUBLISHED) + def assignment_failed(self): """Return Submissions which have failed assignment.""" return self.filter(status=constants.STATUS_ASSIGNMENT_FAILED) diff --git a/submissions/views.py b/submissions/views.py index 86026817e5f689e45c4793fd79a7586ce6a15077..e80c5017dcfab6219c6af982ffcb70854f80a497 100644 --- a/submissions/views.py +++ b/submissions/views.py @@ -537,7 +537,7 @@ def submission_add_topic(request, identifier_w_vn_nr): except: pass messages.success(request, 'Successfully linked Topic to this Submission') - return submission_detail(request, identifier_w_vn_nr) + return redirect(submission.get_absolute_url()) @permission_required('scipost.can_manage_ontology', raise_exception=True) @@ -558,7 +558,7 @@ def submission_remove_topic(request, identifier_w_vn_nr, slug): except: pass messages.success(request, 'Successfully removed Topic') - return submission_detail(request, identifier_w_vn_nr) + return redirect(submission.get_absolute_url()) @login_required