diff --git a/SciPost_v1/settings/base.py b/SciPost_v1/settings/base.py index 963a519298520825a11f6c956e2f8541572e0f10..44532bc63c162b25e9049c152ba72e079bfeee4a 100644 --- a/SciPost_v1/settings/base.py +++ b/SciPost_v1/settings/base.py @@ -97,6 +97,7 @@ INSTALLED_APPS = ( 'submissions', 'theses', 'virtualmeetings', + 'proceedings', 'production', 'partners', 'funders', diff --git a/journals/constants.py b/journals/constants.py index 7673cf16062813b0d1ceba90839c40b082fce962..3c1d7b5b173d7d7468dc6758ab0621abbb99ea34 100644 --- a/journals/constants.py +++ b/journals/constants.py @@ -7,7 +7,8 @@ SCIPOST_JOURNAL_PHYSICS_PROC = 'SciPostPhysProc' # Journal open for submission SCIPOST_JOURNALS_SUBMIT = ( (SCIPOST_JOURNAL_PHYSICS, 'SciPost Physics'), - (SCIPOST_JOURNAL_PHYSICS_LECTURE_NOTES, 'SciPost Physics Lecture Notes') + (SCIPOST_JOURNAL_PHYSICS_LECTURE_NOTES, 'SciPost Physics Lecture Notes'), + (SCIPOST_JOURNAL_PHYSICS_PROC, 'SciPost Proceedings') ) # Journal closed for submission diff --git a/proceedings/__init__.py b/proceedings/__init__.py new file mode 100644 index 0000000000000000000000000000000000000000..e69de29bb2d1d6434b8b29ae775ad8c2e48c5391 diff --git a/proceedings/admin.py b/proceedings/admin.py new file mode 100644 index 0000000000000000000000000000000000000000..e38d21c74f61ae7fb8b7ac5df3661f1aca53fd67 --- /dev/null +++ b/proceedings/admin.py @@ -0,0 +1,6 @@ +from django.contrib import admin + +from .models import Proceeding + + +admin.site.register(Proceeding) diff --git a/proceedings/apps.py b/proceedings/apps.py new file mode 100644 index 0000000000000000000000000000000000000000..dd2aa26255e92b46cce1f14e6677000b9f6023e7 --- /dev/null +++ b/proceedings/apps.py @@ -0,0 +1,5 @@ +from django.apps import AppConfig + + +class ProceedingsConfig(AppConfig): + name = 'proceedings' diff --git a/proceedings/managers.py b/proceedings/managers.py new file mode 100644 index 0000000000000000000000000000000000000000..525428899d723f6ba6f41a43963af7144835de0d --- /dev/null +++ b/proceedings/managers.py @@ -0,0 +1,6 @@ +from django.db import models + + +class ProceedingQuerySet(models.QuerySet): + def open_for_submission(self): + return self.filter(open_for_submission=True) diff --git a/proceedings/migrations/0001_initial.py b/proceedings/migrations/0001_initial.py new file mode 100644 index 0000000000000000000000000000000000000000..e002e8846e5835d0d30ac8324d797c7e9a98819d --- /dev/null +++ b/proceedings/migrations/0001_initial.py @@ -0,0 +1,27 @@ +# -*- coding: utf-8 -*- +# Generated by Django 1.11.4 on 2017-10-15 20:31 +from __future__ import unicode_literals + +from django.db import migrations, models +import django.db.models.deletion + + +class Migration(migrations.Migration): + + initial = True + + dependencies = [ + ('journals', '0045_auto_20170925_2124'), + ] + + operations = [ + migrations.CreateModel( + name='Proceeding', + fields=[ + ('id', models.AutoField(auto_created=True, primary_key=True, serialize=False, verbose_name='ID')), + ('name', models.CharField(max_length=256)), + ('open_for_submission', models.BooleanField(default=True)), + ('journal', models.ForeignKey(on_delete=django.db.models.deletion.CASCADE, to='journals.Journal')), + ], + ), + ] diff --git a/proceedings/migrations/0002_auto_20171015_2235.py b/proceedings/migrations/0002_auto_20171015_2235.py new file mode 100644 index 0000000000000000000000000000000000000000..ec27ccfd637b44d185ead165e74d30523f0f17dd --- /dev/null +++ b/proceedings/migrations/0002_auto_20171015_2235.py @@ -0,0 +1,39 @@ +# -*- coding: utf-8 -*- +# Generated by Django 1.11.4 on 2017-10-15 20:35 +from __future__ import unicode_literals + +from django.db import migrations, models +import django.db.models.deletion +import django.utils.timezone +import scipost.db.fields + + +class Migration(migrations.Migration): + + dependencies = [ + ('colleges', '0005_fellowship_guest'), + ('proceedings', '0001_initial'), + ] + + operations = [ + migrations.AddField( + model_name='proceeding', + name='created', + field=models.DateTimeField(default=django.utils.timezone.now), + ), + migrations.AddField( + model_name='proceeding', + name='fellowships', + field=models.ManyToManyField(blank=True, related_name='proceedings', to='colleges.Fellowship'), + ), + migrations.AddField( + model_name='proceeding', + name='latest_activity', + field=scipost.db.fields.AutoDateTimeField(blank=True, default=django.utils.timezone.now, editable=False), + ), + migrations.AlterField( + model_name='proceeding', + name='journal', + field=models.ForeignKey(on_delete=django.db.models.deletion.CASCADE, related_name='proceedings', to='journals.Journal'), + ), + ] diff --git a/proceedings/migrations/__init__.py b/proceedings/migrations/__init__.py new file mode 100644 index 0000000000000000000000000000000000000000..e69de29bb2d1d6434b8b29ae775ad8c2e48c5391 diff --git a/proceedings/models.py b/proceedings/models.py new file mode 100644 index 0000000000000000000000000000000000000000..d82ab3b6a4acf4f02fcdb8001a47d728e35da6d7 --- /dev/null +++ b/proceedings/models.py @@ -0,0 +1,25 @@ +from django.db import models + +from scipost.behaviors import TimeStampedModel + +from .managers import ProceedingQuerySet + + +class Proceeding(TimeStampedModel): + """ + A Proceeding is a special kind of Journal Issue. + """ + journal = models.ForeignKey('journals.Journal') + name = models.CharField(max_length=256) + open_for_submission = models.BooleanField(default=True) + + fellowships = models.ManyToManyField('colleges.Fellowship', blank=True, + limit_choices_to={'guest': True}) + + objects = ProceedingQuerySet.as_manager() + + class Meta: + default_related_name = 'proceedings' + + def __str__(self): + return self.name diff --git a/proceedings/tests.py b/proceedings/tests.py new file mode 100644 index 0000000000000000000000000000000000000000..7ce503c2dd97ba78597f6ff6e4393132753573f6 --- /dev/null +++ b/proceedings/tests.py @@ -0,0 +1,3 @@ +from django.test import TestCase + +# Create your tests here. diff --git a/proceedings/urls.py b/proceedings/urls.py new file mode 100644 index 0000000000000000000000000000000000000000..c8d7a6f3913999a893a766c6e908ccd6340a6873 --- /dev/null +++ b/proceedings/urls.py @@ -0,0 +1,8 @@ +from django.conf.urls import url + +from . import views + +urlpatterns = [ + # Proceedings + url(r'^proceedings/$', views.proceedings, name='proceedings'), +] diff --git a/proceedings/views.py b/proceedings/views.py new file mode 100644 index 0000000000000000000000000000000000000000..46f9546acfa9df208d2e3a2d21bf45f2afc7967d --- /dev/null +++ b/proceedings/views.py @@ -0,0 +1,9 @@ +from django.contrib.auth.decorators import login_required, permission_required +from django.shortcuts import render + + +@login_required +@permission_required('scipost.can_manage_college_composition', raise_exception=True) +def proceedings(request): + context = {} + return render(request, 'proceedings/index.html', context) diff --git a/scipost/templates/scipost/personal_page.html b/scipost/templates/scipost/personal_page.html index df6434f83530092e5f3ad28a0e65b77f61e91af5..6d7d891049538eb63db1715b1f1d6177ce10bde4 100644 --- a/scipost/templates/scipost/personal_page.html +++ b/scipost/templates/scipost/personal_page.html @@ -310,6 +310,7 @@ <li><a href="{% url 'journals:manage_metadata' %}">Manage Publication metadata</a></li> <li><a href="{% url 'journals:manage_report_metadata' %}">Manage Report metadata</a></li> <li><a href="{% url 'journals:manage_comment_metadata' %}">Manage Comment metadata</a></li> + <li><a href="{% url 'colleges:fellowships' %}">Manage Fellowships</a></li> </ul> {% endif %} diff --git a/submissions/admin.py b/submissions/admin.py index b8f7d412f80e640776133cbf3c0efc3b0c6c7a46..33976c2de9b3ec1cf5fe99a6a63825ee4fa765f8 100644 --- a/submissions/admin.py +++ b/submissions/admin.py @@ -86,7 +86,8 @@ class SubmissionAdmin(GuardedModelAdmin): 'discipline', 'domain', 'subject_area', - 'secondary_areas'), + 'secondary_areas', + 'proceeding'), }), ('Authors', { 'classes': ('collapse',), diff --git a/submissions/forms.py b/submissions/forms.py index 65bf13df8aeffb19397ed6d770c2790facaba2ab..07768c64a2d6bbfb2ba2c6279e9235fb51a6e74c 100644 --- a/submissions/forms.py +++ b/submissions/forms.py @@ -18,6 +18,7 @@ from .models import Submission, RefereeInvitation, Report, EICRecommendation, Ed iThenticateReport from colleges.models import Fellowship +from journals.constants import SCIPOST_JOURNAL_PHYSICS_PROC from scipost.constants import SCIPOST_SUBJECT_AREAS from scipost.services import ArxivCaller from scipost.models import Contributor @@ -223,6 +224,7 @@ class RequestSubmissionForm(SubmissionChecks, forms.ModelForm): 'is_resubmission', 'discipline', 'submitted_to_journal', + 'proceeding', 'submission_type', 'domain', 'subject_area', @@ -257,6 +259,11 @@ class RequestSubmissionForm(SubmissionChecks, forms.ModelForm): self.fields['list_of_changes'].widget.attrs.update({ 'placeholder': 'Give a point-by-point list of changes (will be viewable online)'}) + # Proceedings submission + qs = self.fields['proceeding'].queryset.open_for_submission() + self.fields['proceeding'].queryset = qs + self.fields['proceeding'].empty_label = None + # Update placeholder for the other fields self.fields['arxiv_link'].widget.attrs.update({ 'placeholder': 'ex.: arxiv.org/abs/1234.56789v1'}) @@ -279,6 +286,10 @@ class RequestSubmissionForm(SubmissionChecks, forms.ModelForm): self.do_pre_checks(cleaned_data['arxiv_identifier_w_vn_nr']) self.arxiv_meets_regex(cleaned_data['arxiv_identifier_w_vn_nr'], cleaned_data['submitted_to_journal']) + + if self.cleaned_data['submitted_to_journal'] != SCIPOST_JOURNAL_PHYSICS_PROC: + del self.cleaned_data['proceeding'] + return cleaned_data def clean_author_list(self): @@ -344,9 +355,13 @@ class RequestSubmissionForm(SubmissionChecks, forms.ModelForm): return submission def set_pool(self, submission): - fellows = Fellowship.objects.active().regular().filter( - contributor__discipline=submission.discipline) - submission.pool.set(fellows) + qs = Fellowship.objects.active() + fellows = qs.regular().filter(contributor__discipline=submission.discipline) + submission.fellows.set(fellows) + + if submission.proceeding: + guest_fellows = qs.guests().filter(proceedings=submission.proceeding) + submission.fellows.add(*guest_fellows) @transaction.atomic def save(self): diff --git a/submissions/migrations/0080_submission_proceedings.py b/submissions/migrations/0080_submission_proceedings.py new file mode 100644 index 0000000000000000000000000000000000000000..7e09124c877767adf63312b715de5ea95bea2656 --- /dev/null +++ b/submissions/migrations/0080_submission_proceedings.py @@ -0,0 +1,22 @@ +# -*- coding: utf-8 -*- +# Generated by Django 1.11.4 on 2017-10-15 20:31 +from __future__ import unicode_literals + +from django.db import migrations, models +import django.db.models.deletion + + +class Migration(migrations.Migration): + + dependencies = [ + ('proceedings', '0001_initial'), + ('submissions', '0079_auto_20171014_0951'), + ] + + operations = [ + migrations.AddField( + model_name='submission', + name='proceedings', + field=models.ForeignKey(blank=True, null=True, on_delete=django.db.models.deletion.CASCADE, related_name='submissions', to='proceedings.Proceeding'), + ), + ] diff --git a/submissions/migrations/0081_auto_20171015_2240.py b/submissions/migrations/0081_auto_20171015_2240.py new file mode 100644 index 0000000000000000000000000000000000000000..da143c529c5c1fea051ede0c58b4c69701727260 --- /dev/null +++ b/submissions/migrations/0081_auto_20171015_2240.py @@ -0,0 +1,20 @@ +# -*- coding: utf-8 -*- +# Generated by Django 1.11.4 on 2017-10-15 20:40 +from __future__ import unicode_literals + +from django.db import migrations + + +class Migration(migrations.Migration): + + dependencies = [ + ('submissions', '0080_submission_proceedings'), + ] + + operations = [ + migrations.RenameField( + model_name='submission', + old_name='proceedings', + new_name='proceeding', + ), + ] diff --git a/submissions/models.py b/submissions/models.py index af7df01096ff37633e6ce0b888a0f208100cd310..a95e05225a07634cb3d4bc251d4d6f668aab1f13 100644 --- a/submissions/models.py +++ b/submissions/models.py @@ -69,6 +69,8 @@ class Submission(models.Model): # Replace this by foreignkey? submitted_to_journal = models.CharField(max_length=30, choices=SCIPOST_JOURNALS_SUBMIT, verbose_name="Journal to be submitted to") + proceeding = models.ForeignKey('proceedings.Proceeding', null=True, blank=True, + related_name='submissions') title = models.CharField(max_length=300) # Authors which have been mapped to contributors: diff --git a/submissions/templates/submissions/new_submission.html b/submissions/templates/submissions/new_submission.html index 8e278f366204b9c560033fe9b80da9243c68f2d7..d24b3357b9bb8a133664c791db758719e423a86b 100644 --- a/submissions/templates/submissions/new_submission.html +++ b/submissions/templates/submissions/new_submission.html @@ -10,12 +10,15 @@ $(document).ready(function(){ $('select#id_submitted_to_journal').on('change', function (){ var selection = $(this).val(); + $("#id_proceeding, #id_submission_type").parents('.form-group').hide() + switch(selection){ case "SciPostPhys": $("#id_submission_type").parents('.form-group').show() break; - default: - $("#id_submission_type").parents('.form-group').hide() + case "SciPostPhysProc": + $("#id_proceeding").parents('.form-group').show() + break; } }).trigger('change'); });