diff --git a/commentaries/migrations/0007_commentary_approaches.py b/commentaries/migrations/0007_commentary_approaches.py new file mode 100644 index 0000000000000000000000000000000000000000..d12b8e9b3f77743a0d311e787436582c8673380a --- /dev/null +++ b/commentaries/migrations/0007_commentary_approaches.py @@ -0,0 +1,44 @@ +# Generated by Django 2.1.8 on 2019-09-21 17:17 + +from django.db import migrations, models +import scipost.fields + + +def domains_to_approaches(apps, schema_editor): + Commentary = apps.get_model('commentaries.Commentary') + + for commentary in Commentary.objects.filter(domain__contains='E'): + if commentary.approaches: + commentary.approaches.append('experimental') + else: + commentary.approaches = ('experimental',) + commentary.save() + for commentary in Commentary.objects.filter(domain__contains='T'): + if commentary.approaches: + commentary.approaches.append('theoretical') + else: + commentary.approaches = ('theoretical',) + commentary.save() + for commentary in Commentary.objects.filter(domain__contains='C'): + if commentary.approaches: + commentary.approaches.append('computational') + else: + commentary.approaches = ('computational',) + commentary.save() + + +class Migration(migrations.Migration): + + dependencies = [ + ('commentaries', '0006_auto_20190522_1120'), + ] + + operations = [ + migrations.AddField( + model_name='commentary', + name='approaches', + field=scipost.fields.ChoiceArrayField(base_field=models.CharField(choices=[('theoretical', 'Theoretical'), ('experimental', 'Experimental'), ('computational', 'Computational'), ('phenomenological', 'Phenomenological'), ('observational', 'Observational'), ('clinical', 'Clinical')], max_length=24), blank=True, null=True, size=None, verbose_name='approach(es) [optional]'), + ), + migrations.RunPython(domains_to_approaches, + reverse_code=migrations.RunPython.noop), + ] diff --git a/commentaries/models.py b/commentaries/models.py index b64ec59303e1f7aecb1339dd26f3fcb499d904cc..7e683eedadeeb78f76e4247741115083ff39024e 100644 --- a/commentaries/models.py +++ b/commentaries/models.py @@ -9,7 +9,9 @@ from django.urls import reverse from journals.constants import SCIPOST_JOURNALS_DOMAINS from scipost.behaviors import TimeStampedModel -from scipost.constants import SCIPOST_DISCIPLINES, DISCIPLINE_PHYSICS, SCIPOST_SUBJECT_AREAS +from scipost.constants import SCIPOST_DISCIPLINES, DISCIPLINE_PHYSICS,\ + SCIPOST_APPROACHES, SCIPOST_SUBJECT_AREAS +from scipost.fields import ChoiceArrayField from .constants import COMMENTARY_TYPES from .managers import CommentaryManager @@ -31,6 +33,9 @@ class Commentary(TimeStampedModel): domain = models.CharField(max_length=3, choices=SCIPOST_JOURNALS_DOMAINS) subject_area = models.CharField(max_length=10, choices=SCIPOST_SUBJECT_AREAS, default='Phys:QP') + approaches = ChoiceArrayField( + models.CharField(max_length=24, choices=SCIPOST_APPROACHES), + blank=True, null=True, verbose_name='approach(es) [optional]') open_for_commenting = models.BooleanField(default=True) # Article/publication data diff --git a/journals/migrations/0070_publication_approaches.py b/journals/migrations/0070_publication_approaches.py new file mode 100644 index 0000000000000000000000000000000000000000..c5b8aa04a7732726b947f15548727d4d0200219a --- /dev/null +++ b/journals/migrations/0070_publication_approaches.py @@ -0,0 +1,44 @@ +# Generated by Django 2.1.8 on 2019-09-21 17:17 + +from django.db import migrations, models +import scipost.fields + + +def domains_to_approaches(apps, schema_editor): + Publication = apps.get_model('journals.Publication') + + for publication in Publication.objects.filter(domain__contains='E'): + if publication.approaches: + publication.approaches.append('experimental') + else: + publication.approaches = ('experimental',) + publication.save() + for publication in Publication.objects.filter(domain__contains='T'): + if publication.approaches: + publication.approaches.append('theoretical') + else: + publication.approaches = ('theoretical',) + publication.save() + for publication in Publication.objects.filter(domain__contains='C'): + if publication.approaches: + publication.approaches.append('computational') + else: + publication.approaches = ('computational',) + publication.save() + + +class Migration(migrations.Migration): + + dependencies = [ + ('journals', '0069_auto_20190911_0547'), + ] + + operations = [ + migrations.AddField( + model_name='publication', + name='approaches', + field=scipost.fields.ChoiceArrayField(base_field=models.CharField(choices=[('theoretical', 'Theoretical'), ('experimental', 'Experimental'), ('computational', 'Computational'), ('phenomenological', 'Phenomenological'), ('observational', 'Observational'), ('clinical', 'Clinical')], max_length=24), blank=True, null=True, size=None, verbose_name='approach(es) [optional]'), + ), + migrations.RunPython(domains_to_approaches, + reverse_code=migrations.RunPython.noop), + ] diff --git a/journals/models.py b/journals/models.py index 11c73884ae4916cd0dbc1568ccbe0ec009f948dc..03be2db6f64b6bbef13775b2e43bb92926839006 100644 --- a/journals/models.py +++ b/journals/models.py @@ -25,7 +25,7 @@ from .constants import ( from .helpers import paper_nr_string from .managers import IssueQuerySet, PublicationQuerySet, JournalQuerySet -from scipost.constants import SCIPOST_DISCIPLINES, SCIPOST_SUBJECT_AREAS +from scipost.constants import SCIPOST_DISCIPLINES, SCIPOST_SUBJECT_AREAS, SCIPOST_APPROACHES from scipost.fields import ChoiceArrayField from proceedings.models import Proceedings @@ -426,6 +426,9 @@ class Publication(models.Model): verbose_name='Primary subject area', default='Phys:QP') secondary_areas = ChoiceArrayField( models.CharField(max_length=10, choices=SCIPOST_SUBJECT_AREAS), blank=True, null=True) + approaches = ChoiceArrayField( + models.CharField(max_length=24, choices=SCIPOST_APPROACHES), + blank=True, null=True, verbose_name='approach(es) [optional]') # Authors authors_claims = models.ManyToManyField('scipost.Contributor', blank=True, diff --git a/scipost/constants.py b/scipost/constants.py index 9c423f8b302224ee2de57140e9e6f2c92025099d..0c5772dc37895f7b25034be722ff0fc48d3c4d61 100644 --- a/scipost/constants.py +++ b/scipost/constants.py @@ -15,6 +15,7 @@ SCIPOST_DISCIPLINES = ( (DISCIPLINE_COMPUTERSCIENCE, 'Computer Science'), ) + SCIPOST_SUBJECT_AREAS = ( ('Physics', ( ('Phys:AE', 'Atomic, Molecular and Optical Physics - Experiment'), @@ -139,6 +140,24 @@ subject_areas_dict = {} for k in subject_areas_raw_dict.keys(): subject_areas_dict.update(dict(subject_areas_raw_dict[k])) + +APPROACH_THEORETICAL = 'theoretical' +APPROACH_EXPERIMENTAL = 'experimental' +APPROACH_COMPUTATIONAL = 'computational' +APPROACH_PHENOMENOLOGICAL = 'phenomenological' +APPROACH_OBSERVATIONAL = 'observational' +APPROACH_CLINICAL = 'clinical' + +SCIPOST_APPROACHES = ( + (APPROACH_THEORETICAL, 'Theoretical'), + (APPROACH_EXPERIMENTAL, 'Experimental'), + (APPROACH_COMPUTATIONAL, 'Computational'), + (APPROACH_PHENOMENOLOGICAL, 'Phenomenological'), + (APPROACH_OBSERVATIONAL, 'Observational'), + (APPROACH_CLINICAL, 'Clinical'), +) + + # Contributor types NEWLY_REGISTERED, NORMAL_CONTRIBUTOR = 'newly_registered', 'normal' UNVERIFIABLE_CREDENTIALS, NO_SCIENTIST = 'unverifiable', 'no_scientist' diff --git a/submissions/admin.py b/submissions/admin.py index a98d34377c600a614bfcc1805bb4374bc15583aa..cc5230c1978eae56025053824161757d9378e44a 100644 --- a/submissions/admin.py +++ b/submissions/admin.py @@ -103,6 +103,7 @@ class SubmissionAdmin(GuardedModelAdmin): 'domain', 'subject_area', 'secondary_areas', + 'approaches', 'proceedings'), }), ('Authors', { diff --git a/submissions/forms.py b/submissions/forms.py index 3f91fad3b7a316900a345adea35b1698bfa6269d..2780f3115f1befeea5875951ef34b943d214ed29 100644 --- a/submissions/forms.py +++ b/submissions/forms.py @@ -341,6 +341,7 @@ class SubmissionForm(forms.ModelForm): 'domain', 'subject_area', 'secondary_areas', + 'approaches', 'title', 'author_list', 'abstract', diff --git a/submissions/migrations/0060_submission_approaches.py b/submissions/migrations/0060_submission_approaches.py new file mode 100644 index 0000000000000000000000000000000000000000..bd231fa880ec99ace2d48266d07d0c8b1cdc51b6 --- /dev/null +++ b/submissions/migrations/0060_submission_approaches.py @@ -0,0 +1,44 @@ +# Generated by Django 2.1.8 on 2019-09-21 17:17 + +from django.db import migrations, models +import scipost.fields + + +def domains_to_approaches(apps, schema_editor): + Submission = apps.get_model('submissions.Submission') + + for submission in Submission.objects.filter(domain__contains='E'): + if submission.approaches: + submission.approaches.append('experimental') + else: + submission.approaches = ('experimental',) + submission.save() + for submission in Submission.objects.filter(domain__contains='T'): + if submission.approaches: + submission.approaches.append('theoretical') + else: + submission.approaches = ('theoretical',) + submission.save() + for submission in Submission.objects.filter(domain__contains='C'): + if submission.approaches: + submission.approaches.append('computational') + else: + submission.approaches = ('computational',) + submission.save() + + +class Migration(migrations.Migration): + + dependencies = [ + ('submissions', '0059_auto_20190912_0906'), + ] + + operations = [ + migrations.AddField( + model_name='submission', + name='approaches', + field=scipost.fields.ChoiceArrayField(base_field=models.CharField(choices=[('theoretical', 'Theoretical'), ('experimental', 'Experimental'), ('computational', 'Computational'), ('phenomenological', 'Phenomenological'), ('observational', 'Observational'), ('clinical', 'Clinical')], max_length=24), blank=True, null=True, size=None, verbose_name='approach(es) [optional]'), + ), + migrations.RunPython(domains_to_approaches, + reverse_code=migrations.RunPython.noop), + ] diff --git a/submissions/models.py b/submissions/models.py index fcfb1e36f4b8ae3069023061c73c3448869f29bb..2e9040d87994dff1689f2445c1f9ea79231b7c48 100644 --- a/submissions/models.py +++ b/submissions/models.py @@ -36,7 +36,7 @@ from comments.behaviors import validate_file_extension, validate_max_file_size from comments.models import Comment from scipost.behaviors import TimeStampedModel from scipost.constants import TITLE_CHOICES -from scipost.constants import SCIPOST_DISCIPLINES, SCIPOST_SUBJECT_AREAS +from scipost.constants import SCIPOST_DISCIPLINES, SCIPOST_SUBJECT_AREAS, SCIPOST_APPROACHES from scipost.fields import ChoiceArrayField from scipost.models import Contributor from scipost.storage import SecureFileStorage @@ -61,6 +61,9 @@ class Submission(models.Model): author_list = models.CharField(max_length=10000, verbose_name="author list") discipline = models.CharField(max_length=20, choices=SCIPOST_DISCIPLINES, default='physics') domain = models.CharField(max_length=3, choices=SCIPOST_JOURNALS_DOMAINS) + approaches = ChoiceArrayField( + models.CharField(max_length=24, choices=SCIPOST_APPROACHES), + blank=True, null=True, verbose_name='approach(es) [optional]') editor_in_charge = models.ForeignKey('scipost.Contributor', related_name='EIC', blank=True, null=True, on_delete=models.CASCADE) diff --git a/submissions/templates/partials/submissions/submission_summary.html b/submissions/templates/partials/submissions/submission_summary.html index 2127702247b106c0343e0a43213d42e1e004663b..3375f44ad462e544ce8f715b2352e48acab0148b 100644 --- a/submissions/templates/partials/submissions/submission_summary.html +++ b/submissions/templates/partials/submissions/submission_summary.html @@ -59,13 +59,19 @@ </tr> {% endif %} <tr> - <td>Domain(s):</td> - <td>{{submission.get_domain_display}}</td> + <td>Discipline:</td> + <td>{{ submission.get_discipline_display }}</td> </tr> <tr> <td>Subject area:</td> <td>{{submission.get_subject_area_display}}</td> </tr> + {% if submission.approaches %} + <tr> + <td>Approach{% if submission.approaches|length > 1 %}es{% endif %}:</td> + <td>{% for approach in submission.approaches %}{% if not forloop.first %}, {% endif %}{{ approach|capfirst }}{% endfor %}</td> + </tr> + {% endif %} </table> {% if show_abstract %} diff --git a/theses/migrations/0004_thesislink_approaches.py b/theses/migrations/0004_thesislink_approaches.py new file mode 100644 index 0000000000000000000000000000000000000000..2557d30b1418629807cef34b3e0d440158721253 --- /dev/null +++ b/theses/migrations/0004_thesislink_approaches.py @@ -0,0 +1,44 @@ +# Generated by Django 2.1.8 on 2019-09-21 17:17 + +from django.db import migrations, models +import scipost.fields + + +def domains_to_approaches(apps, schema_editor): + ThesisLink = apps.get_model('theses.ThesisLink') + + for thesis in ThesisLink.objects.filter(domain__contains='E'): + if thesis.approaches: + thesis.approaches.append('experimental') + else: + thesis.approaches = ('experimental',) + thesis.save() + for thesis in ThesisLink.objects.filter(domain__contains='T'): + if thesis.approaches: + thesis.approaches.append('theoretical') + else: + thesis.approaches = ('theoretical',) + thesis.save() + for thesis in ThesisLink.objects.filter(domain__contains='C'): + if thesis.approaches: + thesis.approaches.append('computational') + else: + thesis.approaches = ('computational',) + thesis.save() + + +class Migration(migrations.Migration): + + dependencies = [ + ('theses', '0003_auto_20190522_1120'), + ] + + operations = [ + migrations.AddField( + model_name='thesislink', + name='approaches', + field=scipost.fields.ChoiceArrayField(base_field=models.CharField(choices=[('theoretical', 'Theoretical'), ('experimental', 'Experimental'), ('computational', 'Computational'), ('phenomenological', 'Phenomenological'), ('observational', 'Observational'), ('clinical', 'Clinical')], max_length=24), blank=True, null=True, size=None, verbose_name='approach(es) [optional]'), + ), + migrations.RunPython(domains_to_approaches, + reverse_code=migrations.RunPython.noop), + ] diff --git a/theses/models.py b/theses/models.py index e50026a8002564a54caa2ca54d9ab9f6f080481f..4e192ecfc9c765def2647440d18c1c1381bd75c2 100644 --- a/theses/models.py +++ b/theses/models.py @@ -8,7 +8,8 @@ from django.urls import reverse from django.utils import timezone from journals.constants import SCIPOST_JOURNALS_DOMAINS -from scipost.constants import SCIPOST_DISCIPLINES, SCIPOST_SUBJECT_AREAS +from scipost.constants import SCIPOST_DISCIPLINES, SCIPOST_SUBJECT_AREAS, SCIPOST_APPROACHES +from scipost.fields import ChoiceArrayField from .constants import THESIS_TYPES from .managers import ThesisLinkManager @@ -35,6 +36,9 @@ class ThesisLink(models.Model): max_length=10, choices=SCIPOST_SUBJECT_AREAS, default='Phys:QP') + approaches = ChoiceArrayField( + models.CharField(max_length=24, choices=SCIPOST_APPROACHES), + blank=True, null=True, verbose_name='approach(es) [optional]') open_for_commenting = models.BooleanField(default=True) title = models.CharField(max_length=300, verbose_name='title') pub_link = models.URLField(verbose_name='URL (external repository)')