diff --git a/proceedings/forms.py b/proceedings/forms.py index 8d5fda042821d04fa6f9a6a7070d141ee12ede40..c0a370a644ba8f4849e922fce9bef8a8672f1249 100644 --- a/proceedings/forms.py +++ b/proceedings/forms.py @@ -21,4 +21,5 @@ class ProceedingsForm(forms.ModelForm): 'submissions_open', 'submissions_deadline', 'submissions_close', + 'template_latex_tgz', ) diff --git a/proceedings/migrations/0006_proceedings_template_latex_tgz.py b/proceedings/migrations/0006_proceedings_template_latex_tgz.py new file mode 100644 index 0000000000000000000000000000000000000000..9584121434b6f402fea1185d6553ebe83e866442 --- /dev/null +++ b/proceedings/migrations/0006_proceedings_template_latex_tgz.py @@ -0,0 +1,18 @@ +# Generated by Django 2.1.8 on 2019-08-26 17:45 + +from django.db import migrations, models + + +class Migration(migrations.Migration): + + dependencies = [ + ('proceedings', '0005_auto_20190626_1125'), + ] + + operations = [ + migrations.AddField( + model_name='proceedings', + name='template_latex_tgz', + field=models.FileField(blank=True, help_text='Gzipped tarball of the LaTeX template package', max_length=256, upload_to='UPLOADS/TEMPLATES/latex/%Y/', verbose_name='Template (LaTeX, gzipped tarball)'), + ), + ] diff --git a/proceedings/models.py b/proceedings/models.py index cfef7212562e94372cc77c41292c10c7988c5b70..949ea1e1e6284be4a4cda06f7077b2a5ec9070a1 100644 --- a/proceedings/models.py +++ b/proceedings/models.py @@ -45,6 +45,12 @@ class Proceedings(TimeStampedModel): submissions_deadline = models.DateField() submissions_close = models.DateField() + # Templates + template_latex_tgz = models.FileField( + verbose_name='Template (LaTeX, gzipped tarball)', + help_text='Gzipped tarball of the LaTeX template package', + upload_to='UPLOADS/TEMPLATES/latex/%Y/', max_length=256, blank=True) + objects = ProceedingsQuerySet.as_manager() class Meta: diff --git a/proceedings/templates/partials/proceedings/description.html b/proceedings/templates/partials/proceedings/description.html index f12c62a33097a5cb89acb1127cc5fcde006c4875..3a6e4203610b31603039d1e0cb850e3c3e91ef19 100644 --- a/proceedings/templates/partials/proceedings/description.html +++ b/proceedings/templates/partials/proceedings/description.html @@ -10,13 +10,6 @@ <h3>{{ proceedings.event_name }} {% if proceedings.event_suffix %}({{ proceedings.event_suffix }}){% endif %}</h3> <div class="mb-4"> Event dates: from {{ proceedings.event_start_date }} to {{ proceedings.event_end_date }}. - <div class="my-1"> - <strong>Submission deadline: {{ proceedings.submissions_deadline }}</strong>. - </div> - {% if proceedings.open_for_submission %} - <a href="{% url 'submissions:submit_manuscript' %}">Submit your manuscript here</a>. - Prepare your manuscript according to <a href="{% url 'submissions:author_guidelines' %}">our guidelines</a>, using <a href>our LaTeX template</a>. - {% endif %} </div> {% if proceedings.logo %} </div> @@ -27,6 +20,25 @@ {% endif %} <p>{{ proceedings.event_description|safe|linebreaksbr }}</p> +{% if proceedings.open_for_submission %} + <h3>Instructions for submitting to these Proceedings:</h3> + <ul> + <li> + Prepare your manuscript according to <a href="{% url 'submissions:author_guidelines' %}">our guidelines</a>, using our template: + <ul> + {% if proceedings.template_latex_tgz %} + <li><a href="{{ proceedings.template_latex_tgz.url }}">LaTeX (gzipped tarball)</a></li> + {% else %} + <li>Template will be available soon!</li> + {% endif %} + </ul> + </li> + <li> + Submit your manuscript (<strong>deadline: {{ proceedings.submissions_deadline }}</strong>) by going to our <a href="{% url 'submissions:submit_manuscript' %}">submission page</a>, selecting these proceedings. + </li> + </ul> +{% endif %} + {% if proceedings.cover_image %} </div> <div class="col-lg-1"></div> diff --git a/proceedings/templates/partials/proceedings/summary.html b/proceedings/templates/partials/proceedings/summary.html index fff1104f3e8a6cac206a19d41d9d0e6ec043e4a6..b63a53c2481d833a2eb53d2d7e32ee25d4b0cb75 100644 --- a/proceedings/templates/partials/proceedings/summary.html +++ b/proceedings/templates/partials/proceedings/summary.html @@ -39,4 +39,12 @@ <th>Submission Close</th> <td>{{ proceedings.submissions_close }}</td> </tr> + <tr> + <th>Templates</th> + <td> + {% if proceedings.template_latex_url %} + <a href="{{ proceedings.template_latex_tgz.url }}">LaTeX (gzipped tarball)</a> + {% endif %} + </td> + </tr> </table> diff --git a/proceedings/templates/proceedings/proceedings_edit.html b/proceedings/templates/proceedings/proceedings_edit.html index 4076685963148e5e1f90ab7a2c69dde456a909cd..186ab0cedc0e976dad7c62f0996e72778b47c008 100644 --- a/proceedings/templates/proceedings/proceedings_edit.html +++ b/proceedings/templates/proceedings/proceedings_edit.html @@ -13,7 +13,7 @@ {% block content %} <h1>Edit Proceedings</h1> - <form method="post"> + <form method="post" enctype="multipart/form-data"> {% csrf_token %} {{ form|bootstrap }} <button type="submit" class="btn btn-primary">Save Proceedings</button> diff --git a/profiles/templates/profiles/profile_list.html b/profiles/templates/profiles/profile_list.html index 3483eb6598a78341eff7ff7a0c6b8ac3f22ee779..ab46b247e25ca9433fe9cae2ccd910615803ce69 100644 --- a/profiles/templates/profiles/profile_list.html +++ b/profiles/templates/profiles/profile_list.html @@ -34,7 +34,7 @@ <li><i class="fa fa-check-circle text-success"></i> No name-duplicate Contributors found</li> {% endif %} {% if nr_contributors_w_duplicate_emails > 0 %} - <li><a href="{% url 'scipost:contributor_duplicates' %}?kind=names">Handle Contributors with duplicate emails ({{ nr_contributors_w_duplicate_emails }} to handle)</a></li> + <li><a href="{% url 'scipost:contributor_duplicates' %}?kind=emails">Handle Contributors with duplicate emails ({{ nr_contributors_w_duplicate_emails }} to handle)</a></li> {% else %} <li><i class="fa fa-check-circle text-success"></i> No email-duplicate Contributors found</li> {% endif %} diff --git a/scipost/admin.py b/scipost/admin.py index d9c18ea887512d9d3b30b9ffcd3f6576a1dd17cf..08d72dba4d6e11a029777e6e4b6ac69302b60331 100644 --- a/scipost/admin.py +++ b/scipost/admin.py @@ -8,15 +8,21 @@ from django import forms from django.contrib.auth.admin import UserAdmin from django.contrib.auth.models import User, Permission -from scipost.models import Contributor, Remark,\ +from scipost.models import TOTPDevice, Contributor, Remark,\ AuthorshipClaim, PrecookedEmail,\ - EditorialCollege, EditorialCollegeFellowship, UnavailabilityPeriod + UnavailabilityPeriod from organizations.admin import ContactInline from production.admin import ProductionUserInline from submissions.models import Submission +class TOTPDeviceAdmin(admin.ModelAdmin): + search_fields = ['user',] + +admin.site.register(TOTPDevice) + + admin.site.register(UnavailabilityPeriod) @@ -34,9 +40,16 @@ class ContributorInline(admin.StackedInline): min_num = 0 +class TOTPDeviceInline(admin.StackedInline): + model = TOTPDevice + extra = 0 + min_num = 0 + + class UserAdmin(UserAdmin): inlines = [ ContributorInline, + TOTPDeviceInline, ContactInline, ProductionUserInline ] @@ -137,38 +150,3 @@ class PrecookedEmailAdmin(admin.ModelAdmin): admin.site.register(PrecookedEmail, PrecookedEmailAdmin) - - -class EditorialCollegeAdmin(admin.ModelAdmin): - search_fields = ['discipline', 'member'] - - -admin.site.register(EditorialCollege, EditorialCollegeAdmin) - - -def college_fellow_is_active(fellow): - '''Check if fellow is currently active.''' - return fellow.is_active() - - -class EditorialCollegeFellowshipAdminForm(forms.ModelForm): - contributor = forms.ModelChoiceField( - queryset=Contributor.objects.order_by('user__last_name')) - - class Meta: - model = EditorialCollegeFellowship - fields = '__all__' - - -class EditorialCollegeFellowshipAdmin(admin.ModelAdmin): - list_display = ('__str__', 'college', college_fellow_is_active) - list_filter = ('college', 'affiliation') - search_fields = ['college__discipline', - 'contributor__user__first_name', 'contributor__user__last_name'] - fields = ('contributor', 'college', 'start_date', 'until_date', 'affiliation', ) - - college_fellow_is_active.boolean = True - form = EditorialCollegeFellowshipAdminForm - - -admin.site.register(EditorialCollegeFellowship, EditorialCollegeFellowshipAdmin) diff --git a/scipost/factories.py b/scipost/factories.py index 4d86a30baa7200de718037db1fb4497785266c34..6f3128d64f8a7787b6dfe68724254337884cad31 100644 --- a/scipost/factories.py +++ b/scipost/factories.py @@ -11,7 +11,7 @@ from django.contrib.auth.models import Group from common.helpers import generate_orcid from submissions.models import Submission -from .models import Contributor, EditorialCollege, EditorialCollegeFellowship, Remark, TOTPDevice +from .models import Contributor, Remark, TOTPDevice from .constants import TITLE_CHOICES, SCIPOST_SUBJECT_AREAS, NORMAL_CONTRIBUTOR @@ -89,23 +89,6 @@ class TOTPDeviceFactory(factory.django.DjangoModelFactory): model = TOTPDevice -class EditorialCollegeFactory(factory.django.DjangoModelFactory): - discipline = random.choice(['Physics', 'Chemistry', 'Medicine']) - - class Meta: - model = EditorialCollege - django_get_or_create = ('discipline',) - - -class EditorialCollegeFellowshipFactory(factory.django.DjangoModelFactory): - college = factory.Iterator(EditorialCollege.objects.all()) - contributor = factory.Iterator(Contributor.objects.exclude( - user__username='deleted').order_by('?')) - - class Meta: - model = EditorialCollegeFellowship - - class SubmissionRemarkFactory(factory.django.DjangoModelFactory): contributor = factory.Iterator(Contributor.objects.all()) submission = factory.Iterator(Submission.objects.all()) diff --git a/scipost/migrations/0027_auto_20190826_0924.py b/scipost/migrations/0027_auto_20190826_0924.py new file mode 100644 index 0000000000000000000000000000000000000000..c43fc5cdace4bb9f55bdbaba9589fd93b306b6b8 --- /dev/null +++ b/scipost/migrations/0027_auto_20190826_0924.py @@ -0,0 +1,17 @@ +# Generated by Django 2.1.8 on 2019-08-26 07:24 + +from django.db import migrations + + +class Migration(migrations.Migration): + + dependencies = [ + ('scipost', '0026_auto_20190522_1120'), + ] + + operations = [ + migrations.AlterModelOptions( + name='totpdevice', + options={'default_related_name': 'devices', 'verbose_name': 'TOTP Device'}, + ), + ] diff --git a/scipost/migrations/0028_auto_20190827_2023.py b/scipost/migrations/0028_auto_20190827_2023.py new file mode 100644 index 0000000000000000000000000000000000000000..dedaef2ce6a61d6e3809a9072a9ad9386e0ba48e --- /dev/null +++ b/scipost/migrations/0028_auto_20190827_2023.py @@ -0,0 +1,31 @@ +# Generated by Django 2.1.8 on 2019-08-27 18:23 + +from django.db import migrations + + +class Migration(migrations.Migration): + + dependencies = [ + ('scipost', '0027_auto_20190826_0924'), + ] + + operations = [ + migrations.AlterUniqueTogether( + name='editorialcollegefellowship', + unique_together=set(), + ), + migrations.RemoveField( + model_name='editorialcollegefellowship', + name='college', + ), + migrations.RemoveField( + model_name='editorialcollegefellowship', + name='contributor', + ), + migrations.DeleteModel( + name='EditorialCollege', + ), + migrations.DeleteModel( + name='EditorialCollegeFellowship', + ), + ] diff --git a/scipost/models.py b/scipost/models.py index be2d448c1628adf463d4ce056b05af6cafd5cfba..57fed958d6b1bd8689a34a3321e5c4e345f7a823 100644 --- a/scipost/models.py +++ b/scipost/models.py @@ -52,6 +52,7 @@ class TOTPDevice(models.Model): class Meta: default_related_name = 'devices' + verbose_name = 'TOTP Device' def __str__(self): return '{}: {}'.format(self.user, self.name) @@ -328,51 +329,3 @@ class PrecookedEmail(models.Model): def __str__(self): return self.email_subject - - -###################### -# Static info models # -###################### - -class EditorialCollege(models.Model): - """A SciPost Editorial College for a specific discipline. - - DEPRECATED. To be removed. - """ - discipline = models.CharField(max_length=255, unique=True) - - def __str__(self): - return self.discipline - - -class EditorialCollegeFellowship(TimeStampedModel): - """ - Editorial College Fellowship connecting Editorial College and Contributors, - maybe with a limiting start/until date. - - DEPRECATED. To be removed. - """ - contributor = models.ForeignKey('scipost.Contributor', on_delete=models.CASCADE, - related_name='+') - college = models.ForeignKey('scipost.EditorialCollege', on_delete=models.CASCADE, - related_name='fellowships') - affiliation = models.CharField(max_length=255, blank=True) - start_date = models.DateField(null=True, blank=True) - until_date = models.DateField(null=True, blank=True) - - objects = FellowManager() - - class Meta: - unique_together = ('contributor', 'college', 'start_date', 'until_date') - - def __str__(self): - return self.contributor.__str__() - - def is_active(self): - if not self.start_date: - if not self.until_date: - return True - return today <= self.until_date - elif not self.until_date: - return today >= self.start_date - return today >= self.start_date and today <= self.until_date diff --git a/scipost/templates/scipost/about.html b/scipost/templates/scipost/about.html index b3d128b980a6986bcfca59c9277cc1acae71b9d6..f8a20cfe4f7b73b7e54a38308e9c6919e15a8632 100644 --- a/scipost/templates/scipost/about.html +++ b/scipost/templates/scipost/about.html @@ -155,28 +155,65 @@ </div> </div> - <div class="row justify-content-center"> - <div class="col-lg-3 col-md-4"> - <ul> - <li>Prof. <a target="_blank" href="//www.nikhef.nl/~h02/">J. J. Engelen</a><br/>(U. van Amsterdam)</li> - <li>Prof. <a target="_blank" href="//www.asc.ox.ac.uk/person/18">P. Fendley</a><br/>(Oxford; <a href="https://www.asc.ox.ac.uk/all-souls-college-oxford">All Souls College</a>)</li> - <li>Prof. <a target="_blank" href="//www.ru.nl/highenergyphysics/ehep/persons/sijbrand_de_jong/">S. J. de Jong</a><br/>(Radboud Univ. Nijmegen,<br/>President CERN Council)</li> - </ul> + <div class="card m-2"> + <div class="card-header text-center">Physics</div> + <div class="card-body"> + <div class="row justify-content-center"> + <div class="col-lg-3 col-md-4"> + <ul> + <li>Prof. <a target="_blank" href="//www.nikhef.nl/~h02/">J. J. Engelen</a><br/>(U. van Amsterdam)</li> + <li>Prof. <a target="_blank" href="//www.asc.ox.ac.uk/person/18">P. Fendley</a><br/>(Oxford; <a href="https://www.asc.ox.ac.uk/all-souls-college-oxford">All Souls College</a>)</li> + <li>Prof. <a target="_blank" href="//www.ru.nl/highenergyphysics/ehep/persons/sijbrand_de_jong/">S. J. de Jong</a><br/>(Radboud Univ. Nijmegen)</li> + <li>Prof. <a target="_blank" href="//www.ens-lyon.fr/PHYSIQUE/presentation/annuaire/maillet-jean-michel">J. M. Maillet</a><br/>(ENS Lyon)</li> + </ul> + </div> + <div class="col-lg-3 col-md-4"> + <ul> + <li>Prof. <a target="_blank" href="https://www.rug.nl/staff/p.rudolf/research">P. Rudolf</a><br/>(Groningen)</li> + <li>Prof. <a target="_blank" href="//www.ru.nl/ssi/members/theo_rasing/">T. Rasing</a><br/>(Radboud U. Nijmegen)</li> + <li>Prof. <a target="_blank" href="//atomchip.org/general-information/people/schmiedmayer/">J. Schmiedmayer</a><br/>(TU Vienna)</li> + <li>Prof. <a target="_blank" href="//www.professoren.tum.de/en/spohn-herbert/">H. Spohn</a><br/>(TU Munich)</li> + </ul> + </div> + <div class="col-lg-3 col-md-4"> + <ul> + <li>Prof. <a target="_blank" href="//www.comp.phys.ethz.ch/people/troyer.html">M. Troyer</a><br/>(ETH Zurich)</li> + <li>Prof. <a target="_blank" href="//www.uva.nl/over-de-uva/organisatie/medewerkers/content/v/e/e.p.verlinde/e.p.verlinde.html">E. P. Verlinde</a><br/>(U. van Amsterdam)</li> + <li>Prof. <a target="_blank" href="//staff.fnwi.uva.nl/j.t.m.walraven/walraven/JookWalraven.htm">J. T. M. Walraven</a><br/>(U. van Amsterdam)</li> + </ul> + </div> + </div> </div> - <div class="col-lg-3 col-md-4"> - <ul> - <li>Prof. <a target="_blank" href="//www.ens-lyon.fr/PHYSIQUE/presentation/annuaire/maillet-jean-michel">J. M. Maillet</a><br/>(ENS Lyon)</li> - <li>Prof. <a target="_blank" href="//www.ru.nl/ssi/members/theo_rasing/">T. Rasing</a><br/>(Radboud Univ. Nijmegen)</li> - <li>Prof. <a target="_blank" href="//atomchip.org/general-information/people/schmiedmayer/">J. Schmiedmayer</a><br/>(TU Vienna)</li> - </ul> + </div> + + <div class="card m-2"> + <div class="card-header text-center">Chemistry</div> + <div class="card-body"> + <div class="row justify-content-center"> + <div class="col-lg-3 col-md-4"> + <ul> + <li>Prof. <a target="_blank" href="https://www.ru.nl/english/people/rutjes-f/">F.P.J.T. Rutjes</a><br/>(Radboud U. Nijmegen)</li> + </ul> + </div> + </div> </div> - <div class="col-lg-3 col-md-4"> - <ul> - <li>Prof. <a target="_blank" href="//www.professoren.tum.de/en/spohn-herbert/">H. Spohn</a><br/>(TU Munich)</li> - <li>Prof. <a target="_blank" href="//www.comp.phys.ethz.ch/people/troyer.html">M. Troyer</a><br/>(ETH Zurich)</li> - <li>Prof. <a target="_blank" href="//www.uva.nl/over-de-uva/organisatie/medewerkers/content/v/e/e.p.verlinde/e.p.verlinde.html">E. P. Verlinde</a><br/>(U. van Amsterdam)</li> - <li>Prof. <a target="_blank" href="//staff.fnwi.uva.nl/j.t.m.walraven/walraven/JookWalraven.htm">J. T. M. Walraven</a><br/>(U. van Amsterdam)</li> - </ul> + </div> + + <div class="card m-2"> + <div class="card-header text-center">Mathematics</div> + <div class="card-body"> + <div class="row justify-content-center"> + <div class="col-lg-3 col-md-4"> + <ul> + <li>Prof. <a target="_blank" href="https://staff.fnwi.uva.nl/e.m.opdam/">E. Opdam</a><br/>(U. van Amsterdam)</li> + </ul> + </div> + <div class="col-lg-3 col-md-4"> + <ul> + <li>Prof. <a target="_blank" href="https://math.berkeley.edu/~reshetik/">N. Reshetikhin</a><br/>(UC Berkeley)</li> + </ul> + </div> + </div> </div> </div> diff --git a/scipost/test_views.py b/scipost/test_views.py index 15ece1cf016271af3b0174597932d37066887bde..69fae6f60af05b50488b655a7bbe00e1bafb701b 100644 --- a/scipost/test_views.py +++ b/scipost/test_views.py @@ -11,9 +11,7 @@ from commentaries.factories import UnvettedCommentaryFactory, CommentaryFactory, from commentaries.forms import CommentarySearchForm from commentaries.models import Commentary -from .factories import ContributorFactory,\ - EditorialCollegeFellowshipFactory, EditorialCollegeFactory -from .models import EditorialCollege, EditorialCollegeFellowship +from .factories import ContributorFactory class RequestCommentaryTest(TestCase): @@ -131,28 +129,3 @@ class CommentaryDetailTest(TestCase): def test_status_code_200(self): response = self.client.get(self.target) self.assertEqual(response.status_code, 200) - - -@tag('static-info', 'full') -class AboutViewTest(TestCase): - def setUp(self): - self.client = Client() - self.target = reverse('scipost:about') - - # Create College with 10 members - self.college = EditorialCollegeFactory() - EditorialCollegeFellowshipFactory.create_batch(10) - - def test_status_code_200_including_members(self): - response = self.client.get(self.target) - self.assertEqual(response.status_code, 200) - - # College exists in context - self.assertTrue('object_list' in response.context) - college = response.context['object_list'][0] - self.assertTrue(isinstance(college, EditorialCollege)) - - # Members exist in college - self.assertTrue(college.member.count() >= 10) - last_member = college.member.last() - self.assertTrue(isinstance(last_member, EditorialCollegeFellowship)) diff --git a/scipost/totp.py b/scipost/totp.py index 3af23ed5fc3b409d951e3afcc806b2aa15c63599..35d39901dbc3d632056454b3babea7e10fce1221 100644 --- a/scipost/totp.py +++ b/scipost/totp.py @@ -23,8 +23,8 @@ class TOTPVerification: Verify a time-dependent code for a certain User. """ try: - # Try to see if input token is convertable to integer. - # Do not actually make it a integer, because it'll loose the leading 0s. + # Try to see if input token is convertible to integer. + # Do not actually make it an integer, because it'll lose the leading 0s. assert int(code) > 0 except (ValueError, AssertionError): # return False, if token could not be converted to an integer @@ -59,8 +59,8 @@ class TOTPVerification: Independently verify a secret_key/code combination at current time. """ try: - # Try to see if input token is convertable to integer. - # Do not actually make it a integer, because it'll loose the leading 0s. + # Try to see if input token is convertible to integer. + # Do not actually make it an integer, because it'll lose the leading 0s. assert int(code) > 0 except (ValueError, AssertionError): # return False, if token could not be converted to an integer diff --git a/scipost/views.py b/scipost/views.py index 175c2558e9310d4399c532399aa1635d572df2e6..5108baf6cedd4d859a444edc245af9dc943e313b 100644 --- a/scipost/views.py +++ b/scipost/views.py @@ -1149,7 +1149,7 @@ class ContributorDuplicateListView(PermissionsMixin, PaginationMixin, ListView): if self.request.GET.get('kind') == 'names': queryset = queryset.with_duplicate_names() elif self.request.GET.get('kind') == 'emails': - queryset = queryset.with_duplicate_emails() + queryset = queryset.with_duplicate_email() else: queryset = queryset.with_duplicate_names() return queryset diff --git a/submissions/views.py b/submissions/views.py index 7adcdc8a66f779fd3876de7ed37b51f9c654ea7e..f4b7c5fea9aada0b61ea9b4c2aa61acc69202293 100644 --- a/submissions/views.py +++ b/submissions/views.py @@ -257,9 +257,10 @@ def withdraw_manuscript(request, identifier_w_vn_nr): submission = form.save() # Inform EIC - mail_sender_eic = DirectMailUtil( - 'eic/inform_eic_manuscript_withdrawn', submission=submission) - mail_sender_eic.send_mail() + if submission.editor_in_charge: + mail_sender_eic = DirectMailUtil( + 'eic/inform_eic_manuscript_withdrawn', submission=submission) + mail_sender_eic.send_mail() # Confirm withdrawal to authors mail_sender_authors = DirectMailUtil(