diff --git a/SciPost_v1/settings/base.py b/SciPost_v1/settings/base.py index b2d50e8e7c3aceae9f9eb0667aab921949511065..760615bd5f411f88a7d34b7df20f3ac85cd48ccb 100644 --- a/SciPost_v1/settings/base.py +++ b/SciPost_v1/settings/base.py @@ -260,8 +260,6 @@ MAILCHIMP_API_KEY = 'test_API-key' # iThenticate ITHENTICATE_USERNAME = 'test_ithenticate_username' ITHENTICATE_PASSWORD = 'test_ithenticate_password' -# # Default folder to upload to, else uses the first folder of your account. -ITHENTICATE_DEFAULT_FOLDER_ID = None # Own settings JOURNALS_DIR = 'journals' diff --git a/SciPost_v1/settings/production.py b/SciPost_v1/settings/production.py index 617b72fdfcb8fdedab16b941119320d3ab092fad..4684131ba99c81a75a982f11218b2813d7e14c23 100644 --- a/SciPost_v1/settings/production.py +++ b/SciPost_v1/settings/production.py @@ -46,4 +46,3 @@ MAILCHIMP_API_KEY = get_secret("MAILCHIMP_API_KEY") # iThenticate ITHENTICATE_USERNAME = get_secret('ITHENTICATE_USERNAME') ITHENTICATE_PASSWORD = get_secret('ITHENTICATE_PASSWORD') -ITHENTICATE_DEFAULT_FOLDER_ID = get_secret('ITHENTICATE_FOLDER_ID') diff --git a/SciPost_v1/signalprocessors.py b/SciPost_v1/signalprocessors.py index 8d74cb8efb8bd2d42b6803518eddf3944846c7de..585051caeda166da1e513d4562d1db929bd2b0ba 100644 --- a/SciPost_v1/signalprocessors.py +++ b/SciPost_v1/signalprocessors.py @@ -25,10 +25,30 @@ class AutoSearchIndexingProcessor(signals.RealtimeSignalProcessor): # TODO: Maybe log it or let the exception bubble? pass + def update_instance_indexes(self, sender, instance): + """ + Given an individual model instance, update its entire indexes. + """ + try: + using_backends = self.connection_router.for_write(instance=instance) + except IndexError: + # No submissions given, stop processing here + return None + + for using in using_backends: + try: + index = self.connections[using].get_unified_index().get_index(sender) + index.update(using=using) + except NotHandled: + # TODO: Maybe log it or let the exception bubble? + pass + def handle_save(self, sender, instance, **kwargs): if isinstance(instance, Submission): # Submission have complex status handling, so a status change should lead to # more drastic reindexing. self.prepare_submission_indexing(sender, [instance]) self.prepare_submission_indexing(sender, instance.other_versions) - super().handle_save(sender, instance, **kwargs) + self.update_instance_indexes(sender, instance) + else: + super().handle_save(sender, instance, **kwargs) diff --git a/models.py b/models.py deleted file mode 100644 index 578b6c71dd5d2f603bab5c7534eb3c3c17473120..0000000000000000000000000000000000000000 --- a/models.py +++ /dev/null @@ -1,60 +0,0 @@ -from django.db import models -from django.core.urlresolvers import reverse - -from staff.behaviors import WhiteLabelClientMixin, TimeStampedMixin - -from .managers import LocationManager - - -class Location(WhiteLabelClientMixin): - """ - Physical location to be related to WCLs. - """ - code = models.CharField(max_length=64) - client = models.ForeignKey('clients.Client', related_name='locations', blank=True, null=True) - subtitle = models.CharField(max_length=128, blank=True) - address = models.CharField(max_length=512) - postal_code = models.CharField(max_length=512, blank=True) - main_phone = models.CharField(max_length=32, blank=True) - city = models.CharField(max_length=512, blank=True) - description = models.TextField(blank=True) - - objects = LocationManager() - - class Meta: - unique_together = ('white_label_client', 'code',) - ordering = ('-code',) - - def __str__(self): - return '%s, %s' % (self.address, self.city) - - def get_absolute_url(self): - return reverse('locations:detailview', args=(self.code,)) - - def get_edit_url(self): - return reverse('locations:editview', args=(self.code,)) - - -class GeoLocation(TimeStampedMixin): - """ - Geocode which links `Location` objects to the 2D map. - """ - location = models.OneToOneField('locations.Location') - latitude = models.CharField(max_length=64) - longitude = models.CharField(max_length=64) - - -class LocationObject(TimeStampedMixin): - """ - An physical object can be assigned to a `Location` object. - """ - location = models.ForeignKey('locations.Location', related_name='location_objects') - code = models.CharField(max_length=64, blank=True) - name = models.CharField(max_length=255) - description = models.TextField(blank=True) - - def __str__(self): - _str = self.name - if self.code: - _str += ' (%s)' % self.code - return _str diff --git a/notifications/templates/notifications/partials/notice.html b/notifications/templates/notifications/partials/notice.html index b8ffe85ecab19f7ff0e16b254e8d58488b51b122..5ce4c87d0a529b780c99a5cb9a5113a1cb5497c2 100644 --- a/notifications/templates/notifications/partials/notice.html +++ b/notifications/templates/notifications/partials/notice.html @@ -29,6 +29,6 @@ <p class="mb-1">{{ notice.description|linebreaksbr }}</p> {% endif %} {% if notice.target %} - <a href="{{notice.target.get_absolute_url}}" class="btn btn-default px-0">Go to {{notice.target_content_type}}</a> + <a href="{{notice.get_absolute_url}}" class="btn btn-default px-0">Go to {{notice.target_content_type}}</a> {% endif %} </div> diff --git a/scipost/templates/scipost/index.html b/scipost/templates/scipost/index.html index 8e8b59886ec9c92fb95432fd1c59d68372c58d1c..f3ac59a3f7e27a01cabc8d02b0552bba89113761 100644 --- a/scipost/templates/scipost/index.html +++ b/scipost/templates/scipost/index.html @@ -112,29 +112,23 @@ <div class="card-footer"><a href="{% url 'news:news' %}">More news</a></div> </div><!-- End news --> - {% comment %} + {# {% comment %}#} <!-- Partners --> <div class="card card-grey"> <div class="card-body"> - <h2 class="card-title"> - <a href="{% url 'partners:partners' %}">Partners</a> - </h2> + <h2 class="card-title">Partners</h2> <div> - <p>Institutions: consider joining our <a href="{% url 'partners:partners' %}">Supporting Partners Board</a>.</p> - Recently joined: - <ul class="mt-1"> - {% for agreement in current_agreements %} - <li><strong>{{agreement.partner.institution.name}}</strong><br> - {{agreement.partner.institution.get_country_display}}</li> - - {% endfor %} - </ul> - + <p> + SciPost guarantees free online access to all publications in all its Journals and does not charge any article processing fees for publishing. Supporting Partners provide operating funds to SciPost. + </p> + <p> + Institutions: consider joining our <a href="{% url 'partners:partners' %}">Supporting Partners Board</a>. SciPost cannot exist without your support. + </p> </div> </div> </div><!-- End Partners --> - {% endcomment %} + {# {% endcomment %}#} <!-- Summarized --> <div class="card card-grey"> diff --git a/submissions/views.py b/submissions/views.py index cc692d3d554faf94ebca8e630aef75ce31442289..b3a453aa083be8fa8454b4911a33111af325abbf 100644 --- a/submissions/views.py +++ b/submissions/views.py @@ -5,7 +5,7 @@ from django.contrib import messages from django.contrib.auth.decorators import login_required, permission_required from django.contrib.auth.models import Group from django.core.urlresolvers import reverse, reverse_lazy -from django.db import transaction +from django.db import transaction, IntegrityError from django.http import Http404, HttpResponse, HttpResponseRedirect from django.shortcuts import get_object_or_404, render, redirect from django.template import Template, Context @@ -21,7 +21,7 @@ from guardian.shortcuts import assign_perm, get_objects_for_user from .constants import SUBMISSION_STATUS_VOTING_DEPRECATED, STATUS_VETTED, STATUS_EIC_ASSIGNED,\ SUBMISSION_STATUS_PUBLICLY_INVISIBLE, SUBMISSION_STATUS, ED_COMM_CHOICES,\ - STATUS_DRAFT + STATUS_DRAFT, CYCLE_DIRECT_REC from .models import Submission, EICRecommendation, EditorialAssignment,\ RefereeInvitation, Report, EditorialCommunication, SubmissionEvent from .mixins import SubmissionAdminViewMixin @@ -644,6 +644,10 @@ def cycle_form_submit(request, arxiv_identifier_w_vn_nr): messages.success(request, ('<h3>Your choice has been confirmed</h3>' 'The new cycle will be <em>%s</em>' % submission.get_refereeing_cycle_display())) + if submission.refereeing_cycle == CYCLE_DIRECT_REC: + # Redirect to EIC Recommendation page immediately + return redirect(reverse('submissions:eic_recommendation', + args=[submission.arxiv_identifier_w_vn_nr])) return redirect(reverse('submissions:editorial_page', args=[submission.arxiv_identifier_w_vn_nr])) @@ -1339,17 +1343,29 @@ def vote_on_rec(request, rec_id): form = RecommendationVoteForm(request.POST or None) if form.is_valid(): if form.cleaned_data['vote'] == 'agree': - recommendation.voted_for.add(request.user.contributor) + try: + recommendation.voted_for.add(request.user.contributor) + except IntegrityError: + messages.warning(request, 'You have already voted for this Recommendation.') + return redirect(reverse('submissions:pool')) recommendation.voted_against.remove(request.user.contributor) recommendation.voted_abstain.remove(request.user.contributor) elif form.cleaned_data['vote'] == 'disagree': recommendation.voted_for.remove(request.user.contributor) - recommendation.voted_against.add(request.user.contributor) + try: + recommendation.voted_against.add(request.user.contributor) + except IntegrityError: + messages.warning(request, 'You have already voted for this Recommendation.') + return redirect(reverse('submissions:pool')) recommendation.voted_abstain.remove(request.user.contributor) elif form.cleaned_data['vote'] == 'abstain': recommendation.voted_for.remove(request.user.contributor) recommendation.voted_against.remove(request.user.contributor) - recommendation.voted_abstain.add(request.user.contributor) + try: + recommendation.voted_abstain.add(request.user.contributor) + except IntegrityError: + messages.warning(request, 'You have already voted for this Recommendation.') + return redirect(reverse('submissions:pool')) if form.cleaned_data['remark']: remark = Remark(contributor=request.user.contributor, recommendation=recommendation,