From 081c053b1196d856771db2161854170c900dbe4e Mon Sep 17 00:00:00 2001 From: "J.-S. Caux" <J.S.Caux@uva.nl> Date: Sun, 16 Sep 2018 21:39:37 +0200 Subject: [PATCH] Delete ProspectiveFellow(Event). --- colleges/admin.py | 14 +- colleges/constants.py | 48 ------- colleges/forms.py | 26 +--- .../migrations/0009_auto_20180916_2134.py | 33 +++++ colleges/models.py | 46 +------ .../colleges/_prospectivefellow_card.html | 56 -------- .../colleges/_prospectivefellow_event_li.html | 6 - .../prospectivefellow_confirm_delete.html | 25 ---- .../colleges/prospectivefellow_form.html | 16 --- .../colleges/prospectivefellow_list.html | 68 ---------- colleges/urls.py | 38 ------ colleges/views.py | 128 +----------------- .../invite_prospective_fellow_initial.html | 9 -- .../invite_prospective_fellow_initial.json | 8 -- 14 files changed, 38 insertions(+), 483 deletions(-) create mode 100644 colleges/migrations/0009_auto_20180916_2134.py delete mode 100644 colleges/templates/colleges/_prospectivefellow_card.html delete mode 100644 colleges/templates/colleges/_prospectivefellow_event_li.html delete mode 100644 colleges/templates/colleges/prospectivefellow_confirm_delete.html delete mode 100644 colleges/templates/colleges/prospectivefellow_form.html delete mode 100644 colleges/templates/colleges/prospectivefellow_list.html delete mode 100644 templates/email/prospectivefellows/invite_prospective_fellow_initial.html delete mode 100644 templates/email/prospectivefellows/invite_prospective_fellow_initial.json diff --git a/colleges/admin.py b/colleges/admin.py index 638fc6fb4..2ee73a501 100644 --- a/colleges/admin.py +++ b/colleges/admin.py @@ -4,8 +4,7 @@ __license__ = "AGPL v3" from django.contrib import admin -from .models import Fellowship, PotentialFellowship, PotentialFellowshipEvent,\ - ProspectiveFellow, ProspectiveFellowEvent +from .models import Fellowship, PotentialFellowship, PotentialFellowshipEvent def fellowhip_is_active(fellowship): @@ -32,14 +31,3 @@ class PotentialFellowshipAdmin(admin.ModelAdmin): search_fields = ['last_name', 'email'] admin.site.register(PotentialFellowship, PotentialFellowshipAdmin) - - -# TO BE DEPRECATED -class ProspectiveFellowEventInline(admin.TabularInline): - model = ProspectiveFellowEvent - -class ProspectiveFellowAdmin(admin.ModelAdmin): - inlines = (ProspectiveFellowEventInline,) - search_fields = ['last_name', 'email'] - -admin.site.register(ProspectiveFellow, ProspectiveFellowAdmin) diff --git a/colleges/constants.py b/colleges/constants.py index c3595156a..55bfe9d9e 100644 --- a/colleges/constants.py +++ b/colleges/constants.py @@ -47,51 +47,3 @@ POTENTIAL_FELLOWSHIP_EVENTS = ( (POTENTIAL_FELLOWSHIP_EVENT_COMMENT, 'Comment'), (POTENTIAL_FELLOWSHIP_EVENT_DEACTIVATION, 'Deactivation: not considered anymore'), ) - - -# TO BE DEPRECATED: -PROSPECTIVE_FELLOW_IDENTIFIED = 'identified' -PROSPECTIVE_FELLOW_INVITED = 'invited' -PROSPECTIVE_FELLOW_REINVITED = 'reinvited' -PROSPECTIVE_FELLOW_MULTIPLY_REINVITED = 'multiplyreinvited' -PROSPECTIVE_FELLOW_DECLINED = 'declined' -PROSPECTIVE_FELLOW_UNRESPONSIVE = 'unresponsive' -PROSPECTIVE_FELLOW_RETIRED = 'retired' -PROSPECTIVE_FELLOW_DECEASED = 'deceased' -PROSPECTIVE_FELLOW_INTERESTED = 'interested' -PROSPECTIVE_FELLOW_REGISTERED = 'registered' -PROSPECTIVE_FELLOW_ACTIVE_IN_COLLEGE = 'activeincollege' -PROSPECTIVE_FELLOW_SCIPOST_EMERITUS = 'emeritus' - -PROSPECTIVE_FELLOW_STATUSES = ( - (PROSPECTIVE_FELLOW_IDENTIFIED, 'Identified as potential Fellow'), - (PROSPECTIVE_FELLOW_INVITED, 'Invited to become Fellow'), - (PROSPECTIVE_FELLOW_REINVITED, 'Reinvited after initial invitation'), - (PROSPECTIVE_FELLOW_MULTIPLY_REINVITED, 'Multiply reinvited'), - (PROSPECTIVE_FELLOW_DECLINED, 'Declined the invitation'), - (PROSPECTIVE_FELLOW_UNRESPONSIVE, 'Marked as unresponsive'), - (PROSPECTIVE_FELLOW_RETIRED, 'Retired'), - (PROSPECTIVE_FELLOW_DECEASED, 'Deceased'), - (PROSPECTIVE_FELLOW_INTERESTED, 'Marked as interested, Fellowship being set up'), - (PROSPECTIVE_FELLOW_REGISTERED, 'Registered as Contributor'), - (PROSPECTIVE_FELLOW_ACTIVE_IN_COLLEGE, 'Currently active in a College'), - (PROSPECTIVE_FELLOW_SCIPOST_EMERITUS, 'SciPost Emeritus'), -) -prospective_Fellow_statuses_dict = dict(PROSPECTIVE_FELLOW_STATUSES) - - -PROSPECTIVE_FELLOW_EVENT_DEFINED = 'defined' -PROSPECTIVE_FELLOW_EVENT_EMAILED = 'emailed' -PROSPECTIVE_FELLOW_EVENT_RESPONDED = 'responded' -PROSPECTIVE_FELLOW_EVENT_STATUSUPDATED = 'statusupdated' -PROSPECTIVE_FELLOW_EVENT_COMMENT = 'comment' -PROSPECTIVE_FELLOW_EVENT_DEACTIVATION = 'deactivation' - -PROSPECTIVE_FELLOW_EVENTS = ( - (PROSPECTIVE_FELLOW_EVENT_DEFINED, 'Defined in database'), - (PROSPECTIVE_FELLOW_EVENT_EMAILED, 'Emailed with invitation'), - (PROSPECTIVE_FELLOW_EVENT_RESPONDED, 'Response received'), - (PROSPECTIVE_FELLOW_EVENT_STATUSUPDATED, 'Status updated'), - (PROSPECTIVE_FELLOW_EVENT_COMMENT, 'Comment'), - (PROSPECTIVE_FELLOW_EVENT_DEACTIVATION, 'Deactivation: not considered anymore'), -) diff --git a/colleges/forms.py b/colleges/forms.py index ce450f17f..7169f95e4 100644 --- a/colleges/forms.py +++ b/colleges/forms.py @@ -12,8 +12,7 @@ from proceedings.models import Proceedings from submissions.models import Submission from scipost.models import Contributor -from .models import Fellowship, PotentialFellowship, PotentialFellowshipEvent,\ - ProspectiveFellow, ProspectiveFellowEvent +from .models import Fellowship, PotentialFellowship, PotentialFellowshipEvent class AddFellowshipForm(forms.ModelForm): @@ -245,26 +244,3 @@ class PotentialFellowshipEventForm(forms.ModelForm): class Meta: model = PotentialFellowshipEvent fields = ['event', 'comments'] - - -# TO BE DEPRECATED -class ProspectiveFellowForm(forms.ModelForm): - - class Meta: - model = ProspectiveFellow - fields = ['title', 'first_name', 'last_name', 'email', - 'discipline', 'expertises', 'webpage', 'status', 'contributor'] - - -class ProspectiveFellowStatusForm(forms.ModelForm): - - class Meta: - model = ProspectiveFellow - fields = ['status'] - - -class ProspectiveFellowEventForm(forms.ModelForm): - - class Meta: - model = ProspectiveFellowEvent - fields = ['event', 'comments'] diff --git a/colleges/migrations/0009_auto_20180916_2134.py b/colleges/migrations/0009_auto_20180916_2134.py new file mode 100644 index 000000000..4e3298c62 --- /dev/null +++ b/colleges/migrations/0009_auto_20180916_2134.py @@ -0,0 +1,33 @@ +# -*- coding: utf-8 -*- +# Generated by Django 1.11.4 on 2018-09-16 19:34 +from __future__ import unicode_literals + +from django.db import migrations + + +class Migration(migrations.Migration): + + dependencies = [ + ('colleges', '0008_prosfellow_to_potfellowship'), + ] + + operations = [ + migrations.RemoveField( + model_name='prospectivefellow', + name='contributor', + ), + migrations.RemoveField( + model_name='prospectivefellowevent', + name='noted_by', + ), + migrations.RemoveField( + model_name='prospectivefellowevent', + name='prosfellow', + ), + migrations.DeleteModel( + name='ProspectiveFellow', + ), + migrations.DeleteModel( + name='ProspectiveFellowEvent', + ), + ] diff --git a/colleges/models.py b/colleges/models.py index f19ae9b5d..5892fb922 100644 --- a/colleges/models.py +++ b/colleges/models.py @@ -9,9 +9,7 @@ from django.urls import reverse from django.utils import timezone from .constants import POTENTIAL_FELLOWSHIP_STATUSES,\ - POTENTIAL_FELLOWSHIP_IDENTIFIED, POTENTIAL_FELLOWSHIP_EVENTS,\ - PROSPECTIVE_FELLOW_STATUSES, PROSPECTIVE_FELLOW_IDENTIFIED,\ - PROSPECTIVE_FELLOW_EVENTS + POTENTIAL_FELLOWSHIP_IDENTIFIED, POTENTIAL_FELLOWSHIP_EVENTS from .managers import FellowQuerySet from profiles.models import Profile @@ -99,45 +97,3 @@ class PotentialFellowshipEvent(models.Model): def __str__(self): return '%s, %s %s: %s' % (self.potfel.last_name, self.potfel.get_title_display(), self.potfel.first_name, self.get_event_display()) - - -class ProspectiveFellow(models.Model): - """ - A ProspectiveFellow is somebody who has been identified as - a potential member of an Editorial College. - """ - title = models.CharField(max_length=4, choices=TITLE_CHOICES) - first_name = models.CharField(max_length=30) - last_name = models.CharField(max_length=150) - email = models.EmailField() - discipline = models.CharField(max_length=20, choices=SCIPOST_DISCIPLINES, - default=DISCIPLINE_PHYSICS, verbose_name='Main discipline') - expertises = ChoiceArrayField( - models.CharField(max_length=10, choices=SCIPOST_SUBJECT_AREAS), - blank=True, null=True) - webpage = models.URLField(blank=True) - status = models.CharField(max_length=32, choices=PROSPECTIVE_FELLOW_STATUSES, - default=PROSPECTIVE_FELLOW_IDENTIFIED) - contributor = models.ForeignKey('scipost.Contributor', on_delete=models.CASCADE, - null=True, blank=True, related_name='+') - - class Meta: - ordering = ['last_name'] - - def __str__(self): - return '%s, %s %s (%s)' % (self.last_name, self.get_title_display(), self.first_name, - self.get_status_display()) - - -class ProspectiveFellowEvent(models.Model): - prosfellow = models.ForeignKey('colleges.ProspectiveFellow', on_delete=models.CASCADE) - event = models.CharField(max_length=32, choices=PROSPECTIVE_FELLOW_EVENTS) - comments = models.TextField(blank=True) - noted_on = models.DateTimeField(default=timezone.now) - noted_by = models.ForeignKey('scipost.Contributor', - on_delete=models.SET(get_sentinel_user), - blank=True, null=True) - - def __str__(self): - return '%s, %s %s: %s' % (self.prosfellow.last_name, self.prosfellow.get_title_display(), - self.prosfellow.first_name, self.get_event_display()) diff --git a/colleges/templates/colleges/_prospectivefellow_card.html b/colleges/templates/colleges/_prospectivefellow_card.html deleted file mode 100644 index 5f1981627..000000000 --- a/colleges/templates/colleges/_prospectivefellow_card.html +++ /dev/null @@ -1,56 +0,0 @@ -{% load bootstrap %} - -<div class="card-body"> - <div class="row"> - <div class="col-6"> - <p> - {{ prosfel.last_name }}, {{ prosfel.get_title_display }} {{ prosfel.first_name }} - <br/> - {{ prosfel.email }} - <br/> - {% if prosfel.webpage %}<a href="{{ prosfel.webpage }}" target="_blank">webpage</a> - {% else %}No personal webpage given - {% endif %} - <br/> - {% if prosfel.contributor %}Associated to Contributor <a href="{{ prosfel.contributor.get_absolute_url }}">{{ prosfel.contributor }}</a></li> - {% else %}No associated Contributor - {% endif %} - </p> - </div> - <div class="col-6"> - <ul> - <li><a href="{% url 'colleges:prospective_Fellow_update' pk=prosfel.id %}">Update</a> the data</li> - <li><a href="{% url 'colleges:prospective_Fellow_delete' pk=prosfel.id %}">Delete</a> this Prosepective Fellow</li> - <li><a href="{% url 'colleges:prospective_Fellow_email_initial' pk=prosfel.id %}">Prepare and send initial email</a></li> - </ul> - </div> - </div> - - <div class="row"> - <div class="col-md-6 ml-auto"> - <h3>Events</h3> - <ul> - {% for event in prosfel.prospectivefellowevent_set.all %} - {% include 'colleges/_prospectivefellow_event_li.html' with event=event %} - {% empty %} - <li>No events found.</li> - {% endfor %} - </ul> - </div> - <div class="col-md-5"> - <h3>Update the status of this Prospective Fellow</h3> - <form class="d-block mt-2 mb-3" action="{% url 'colleges:prospective_Fellow_update_status' pk=prosfel.id %}" method="post"> - {% csrf_token %} - {{ pfstatus_form|bootstrap }} - <input type="submit" name="submit" value="Update status" class="btn btn-outline-secondary"> - </form> - <hr/> - <h3>Add an event for this Prospective Fellow</h3> - <form class="d-block mt-2 mb-3" action="{% url 'colleges:prospective_Fellow_event_create' pk=prosfel.id %}" method="post"> - {% csrf_token %} - {{ pfevent_form|bootstrap }} - <input type="submit" name="submit" value="Submit" class="btn btn-outline-secondary"> - </form> - </div> - </div> -</div> diff --git a/colleges/templates/colleges/_prospectivefellow_event_li.html b/colleges/templates/colleges/_prospectivefellow_event_li.html deleted file mode 100644 index f3f28e66a..000000000 --- a/colleges/templates/colleges/_prospectivefellow_event_li.html +++ /dev/null @@ -1,6 +0,0 @@ -<li id="{{ event.id }}"> - <div class="font-weight-bold">{{ event.get_event_display }} <small class="text-muted">noted {{ event.noted_on }} {% if event.noted_by %}by {{ event.noted_by }}{% endif %}</small></div> - {% if event.comments %} - <div>{{ event.comments|linebreaks }}</div> - {% endif %} -</li> diff --git a/colleges/templates/colleges/prospectivefellow_confirm_delete.html b/colleges/templates/colleges/prospectivefellow_confirm_delete.html deleted file mode 100644 index cd80fe388..000000000 --- a/colleges/templates/colleges/prospectivefellow_confirm_delete.html +++ /dev/null @@ -1,25 +0,0 @@ -{% extends 'scipost/base.html' %} - -{% load bootstrap %} - -{% block pagetitle %}: Delete Prospective Fellow{% endblock pagetitle %} - -{% block content %} -<div class="row"> - <div class="col-12"> - <h1 class="highlight">Delete Prospective Fellow</h1> - {{ object }} - </div> -</div> -<div class="row"> - <div class="col-12"> - <form method="post"> - {% csrf_token %} - <h3 class="mb-2">Are you sure you want to delete this Prospective Fellow?</h3> - <input type="submit" class="btn btn-danger" value="Yes, delete it" /> - </form> - </ul> - </div> -</div> - -{% endblock content %} diff --git a/colleges/templates/colleges/prospectivefellow_form.html b/colleges/templates/colleges/prospectivefellow_form.html deleted file mode 100644 index 31e3ee347..000000000 --- a/colleges/templates/colleges/prospectivefellow_form.html +++ /dev/null @@ -1,16 +0,0 @@ -{% extends 'scipost/base.html' %} - -{% load bootstrap %} - -{% block pagetitle %}: Prospective Fellows{% endblock pagetitle %} - -{% block content %} -<div class="row"> - <div class="col-12"> - <form action="{% url 'colleges:prospective_Fellow_create' %}" method="post"> - {% csrf_token %} - {{ form|bootstrap }} - <input type="submit" value="Submit" class="btn btn-primary"> - </div> -</div> -{% endblock content %} diff --git a/colleges/templates/colleges/prospectivefellow_list.html b/colleges/templates/colleges/prospectivefellow_list.html deleted file mode 100644 index e4b864c10..000000000 --- a/colleges/templates/colleges/prospectivefellow_list.html +++ /dev/null @@ -1,68 +0,0 @@ -{% extends 'scipost/base.html' %} - -{% load scipost_extras %} - -{% load bootstrap %} - -{% block pagetitle %}: Prospective Fellows{% endblock pagetitle %} - -{% block content %} -<div class="row"> - <div class="col-12"> - <p> - <a href="{% url 'colleges:prospective_Fellows' %}">View all</a> or view by discipline/subject area: - {% for discipline in subject_areas %} - <a class="btn btn-primary" data-toggle="collapse" href="#collapse{{ discipline.0|cut:" " }}" role="button" aria-expanded="false" aria-controls="collapse{{ discipline.0|cut:" " }}">{{ discipline.0 }}</a> - {% endfor %} - </p> - {% for discipline in subject_areas %} - <div class="collapse" id="collapse{{ discipline.0|cut:" " }}"> - <p> - {% for area in discipline.1 %} - <a href="{% url 'colleges:prospective_Fellows' %}?discipline={{ discipline.0|cut:" " }}&expertise={{ area.0 }}" method="get">{{ area.0 }}</a> - {% endfor %} - </p> - </div> - {% endfor %} - </div> -</div> -<div class="row"> - <div class="col-12"> - <a href="{% url 'colleges:prospective_Fellow_create' %}">Add a Prospective Fellow</a> - <br/><br/> - <table class="table table-hover mb-5"> - <thead class="thead-default"> - <tr> - <th>Name</th> - <th>Discipline</th> - <th>Expertises</th> - <th>Status</th> - </tr> - </thead> - <tbody id="accordion" role="tablist" aria-multiselectable="true"> - {% for prosfel in object_list %} - <tr data-toggle="collapse" data-parent="#accordion" href="#collapse{{ prosfel.id }}" aria-expanded="false" aria-controls="collapse{{ prosfel.id }}" style="cursor: pointer;"> - <td>{{ prosfel.last_name }}, {{ prosfel.get_title_display }} {{ prosfel.first_name }}</td> - <td>{{ prosfel.get_discipline_display }}</td> - <td> - {% for expertise in prosfel.expertises %} - <div class="single d-inline" data-specialization="{{expertise|lower}}" data-toggle="tooltip" data-placement="bottom" title="{{expertise|get_specialization_display}}">{{expertise|get_specialization_code}}</div> - {% endfor %} - </td> - <td>{{ prosfel.get_status_display }}</td> - </tr> - <tr id="collapse{{ prosfel.id }}" class="collapse" role="tabpanel" aria-labelledby="heading{{ prosfel.id }}" style="background-color: #fff;"> - <td colspan="4"> - {% include 'colleges/_prospectivefellow_card.html' with prosfel=prosfel pfevent_form=pfevent_form %} - </td> - </tr> - {% empty %} - <tr> - <td colspan="4">No Prospective Fellows found</td> - </tr> - {% endfor %} - </tbody> - </table> - </div> -</div> -{% endblock content %} diff --git a/colleges/urls.py b/colleges/urls.py index 10557281e..fd290b952 100644 --- a/colleges/urls.py +++ b/colleges/urls.py @@ -89,42 +89,4 @@ urlpatterns = [ views.PotentialFellowshipListView.as_view(), name='potential_fellowships' ), - - # TO BE DEPRECATED: - # Prospective Fellows - url( - r'^prospectivefellows/$', - views.ProspectiveFellowListView.as_view(), - name='prospective_Fellows' - ), - url( - r'^prospectivefellows/add/$', - views.ProspectiveFellowCreateView.as_view(), - name='prospective_Fellow_create' - ), - url( - r'^prospectivefellows/(?P<pk>[0-9]+)/update/$', - views.ProspectiveFellowUpdateView.as_view(), - name='prospective_Fellow_update' - ), - url( - r'^prospectivefellows/(?P<pk>[0-9]+)/update_status/$', - views.ProspectiveFellowUpdateStatusView.as_view(), - name='prospective_Fellow_update_status' - ), - url( - r'^prospectivefellows/(?P<pk>[0-9]+)/delete/$', - views.ProspectiveFellowDeleteView.as_view(), - name='prospective_Fellow_delete' - ), - url( - r'^prospectivefellows/(?P<pk>[0-9]+)/events/add$', - views.ProspectiveFellowEventCreateView.as_view(), - name='prospective_Fellow_event_create' - ), - url( - r'^prospectivefellows/(?P<pk>[0-9]+)/email/$', - views.ProspectiveFellowInitialEmailView.as_view(), - name='prospective_Fellow_email_initial' - ), ] diff --git a/colleges/views.py b/colleges/views.py index 6d257b6de..293e04dd9 100644 --- a/colleges/views.py +++ b/colleges/views.py @@ -16,19 +16,12 @@ from submissions.models import Submission from .constants import POTENTIAL_FELLOWSHIP_INVITED, potential_fellowship_statuses_dict,\ POTENTIAL_FELLOWSHIP_EVENT_EMAILED, POTENTIAL_FELLOWSHIP_EVENT_STATUSUPDATED,\ POTENTIAL_FELLOWSHIP_EVENT_COMMENT -# NEXT IMPORTS TO BE DEPRECATED -from .constants import PROSPECTIVE_FELLOW_INVITED,\ - prospective_Fellow_statuses_dict,\ - PROSPECTIVE_FELLOW_EVENT_EMAILED, PROSPECTIVE_FELLOW_EVENT_STATUSUPDATED,\ - PROSPECTIVE_FELLOW_EVENT_COMMENT from .forms import FellowshipForm, FellowshipTerminateForm, FellowshipRemoveSubmissionForm,\ FellowshipAddSubmissionForm, AddFellowshipForm, SubmissionAddFellowshipForm,\ FellowshipRemoveProceedingsForm, FellowshipAddProceedingsForm, SubmissionAddVotingFellowForm,\ FellowVotingRemoveSubmissionForm,\ - PotentialFellowshipForm, PotentialFellowshipStatusForm, PotentialFellowshipEventForm,\ - ProspectiveFellowForm, ProspectiveFellowStatusForm, ProspectiveFellowEventForm -from .models import Fellowship, PotentialFellowship, PotentialFellowshipEvent,\ - ProspectiveFellow, ProspectiveFellowEvent + PotentialFellowshipForm, PotentialFellowshipStatusForm, PotentialFellowshipEventForm +from .models import Fellowship, PotentialFellowship, PotentialFellowshipEvent from scipost.constants import SCIPOST_SUBJECT_AREAS from scipost.mixins import PermissionsMixin @@ -422,120 +415,3 @@ class PotentialFellowshipEventCreateView(PermissionsMixin, CreateView): form.instance.noted_by = self.request.user.contributor messages.success(self.request, 'Event added successfully') return super().form_valid(form) - - -# TO BE DEPRECATED: -class ProspectiveFellowCreateView(PermissionsMixin, CreateView): - """ - Formview to create a new Prospective Fellow. - """ - permission_required = 'scipost.can_manage_college_composition' - form_class = ProspectiveFellowForm - template_name = 'colleges/prospectivefellow_form.html' - success_url = reverse_lazy('colleges:prospective_Fellows') - - -class ProspectiveFellowUpdateView(PermissionsMixin, UpdateView): - """ - Formview to update a Prospective Fellow. - """ - permission_required = 'scipost.can_manage_college_composition' - model = ProspectiveFellow - form_class = ProspectiveFellowForm - template_name = 'colleges/prospectivefellow_form.html' - success_url = reverse_lazy('colleges:prospective_Fellows') - - -class ProspectiveFellowUpdateStatusView(PermissionsMixin, UpdateView): - """ - Formview to update the status of a Prospective Fellow. - """ - permission_required = 'scipost.can_manage_college_composition' - model = ProspectiveFellow - fields = ['status'] - success_url = reverse_lazy('colleges:prospective_Fellows') - - def form_valid(self, form): - event = ProspectiveFellowEvent( - prosfellow=self.object, - event=PROSPECTIVE_FELLOW_EVENT_STATUSUPDATED, - comments=('Status updated to %s' - % prospective_Fellow_statuses_dict[form.cleaned_data['status']]), - noted_on=timezone.now(), - noted_by=self.request.user.contributor) - event.save() - return super().form_valid(form) - - -class ProspectiveFellowDeleteView(PermissionsMixin, DeleteView): - """ - Delete a Prospective Fellow. - """ - permission_required = 'scipost.can_manage_college_composition' - model = ProspectiveFellow - success_url = reverse_lazy('colleges:prospective_Fellows') - - -class ProspectiveFellowListView(PermissionsMixin, ListView): - """ - List the ProspectiveFellow object instances. - """ - permission_required = 'scipost.can_manage_college_composition' - model = ProspectiveFellow - paginate_by = 50 - - def get_queryset(self): - """ - Return a queryset of ProspectiveFellows using optional GET data. - """ - queryset = ProspectiveFellow.objects.all() - if 'discipline' in self.request.GET: - queryset = queryset.filter(discipline=self.request.GET['discipline'].lower()) - if 'expertise' in self.request.GET: - queryset = queryset.filter(expertises__contains=[self.request.GET['expertise']]) - return queryset - - def get_context_data(self, **kwargs): - context = super().get_context_data(**kwargs) - context['subject_areas'] = SCIPOST_SUBJECT_AREAS - context['pfstatus_form'] = ProspectiveFellowStatusForm() - context['pfevent_form'] = ProspectiveFellowEventForm() - return context - - -class ProspectiveFellowInitialEmailView(PermissionsMixin, MailView): - """Send a templated email to a Prospective Fellow.""" - - permission_required = 'scipost.can_manage_college_composition' - queryset = ProspectiveFellow.objects.all() - mail_code = 'prospectivefellows/invite_prospective_fellow_initial' - success_url = reverse_lazy('colleges:prospective_Fellows') - - def form_valid(self, form): - """Create an event associated to this outgoing email.""" - event = ProspectiveFellowEvent( - prosfellow=self.object, - event=PROSPECTIVE_FELLOW_EVENT_EMAILED, - comments='Emailed initial template', - noted_on=timezone.now(), - noted_by=self.request.user.contributor) - event.save() - self.object.status = PROSPECTIVE_FELLOW_INVITED - self.object.save() - return super().form_valid(form) - - -class ProspectiveFellowEventCreateView(PermissionsMixin, CreateView): - """ - Add an event for a Prospective Fellow. - """ - permission_required = 'scipost.can_manage_college_composition' - form_class = ProspectiveFellowEventForm - success_url = reverse_lazy('colleges:prospective_Fellows') - - def form_valid(self, form): - form.instance.prosfellow = get_object_or_404(ProspectiveFellow, id=self.kwargs['pk']) - form.instance.noted_on = timezone.now() - form.instance.noted_by = self.request.user.contributor - messages.success(self.request, 'Event added successfully') - return super().form_valid(form) diff --git a/templates/email/prospectivefellows/invite_prospective_fellow_initial.html b/templates/email/prospectivefellows/invite_prospective_fellow_initial.html deleted file mode 100644 index 549c63df2..000000000 --- a/templates/email/prospectivefellows/invite_prospective_fellow_initial.html +++ /dev/null @@ -1,9 +0,0 @@ -<p>Dear {{ prosfel.get_title_display }} {{ prosfel.last_name }},</p> -<p>Hopefully you've already come across <a href="https://scipost.org{% url 'scipost:index' %}">SciPost</a> and are aware of our mission to establish a healthier infrastructure for scientific publishing.</p> -<p>On behalf of the SciPost Foundation and in view of your professional expertise and reputation, I hereby would like to invite you to join our Editorial College and become one of our Editorial Fellows. We are currently making a big push for expansion of our activities, see <a href="https://scipost.org{% url 'scipost:ExpSustDrive2018' %}">this page</a> for details.</p> -<p>Please note that only well-known and respected senior academics are being contacted for this purpose. Academic reputation and involvement in the community are the most important criteria guiding our considerations of who should belong to the Editorial College. The current list of Fellows can be found at <a href="https://scipost.org{% url 'scipost:about' %}">scipost.org/about</a>; on this page, you will also find basic information on SciPost and its guiding principles (you can also take a look at our <a href="https://scipost.org{% url 'scipost:FAQ' %}">frequently asked questions page</a>).</p> -<p>We do not pose any conditions on your involvement, and you would always remain in complete control of your level of commitment (devoting even a couple of hours per month would be enough to help out significantly). Functioning of the College proceeds according to the by-laws set out at <a href="https://scipost.org{% url 'scipost:EdCol_by-laws' %}">scipost.org/EdCol_by-laws</a>, and a short summary of the editorial workflow can be found at <a href="https://scipost.org{% url 'submissions:editorial_workflow' %}">this page</a>. -<p>I would be very happy to provide you with more information should you require it. Could I beg you to give us a response (by replying to this email) within the next couple of weeks?</p> -<p>Many thanks in advance,</p> -<p>Prof. J.-S. Caux, on behalf of the SciPost Foundation</p> -{% include 'email/_footer.html' %} diff --git a/templates/email/prospectivefellows/invite_prospective_fellow_initial.json b/templates/email/prospectivefellows/invite_prospective_fellow_initial.json deleted file mode 100644 index c29403d12..000000000 --- a/templates/email/prospectivefellows/invite_prospective_fellow_initial.json +++ /dev/null @@ -1,8 +0,0 @@ -{ - "subject": "Invitation to become a Fellow at SciPost", - "to_address": "email", - "bcc_to": "admin@scipost.org", - "from_address_name": "SciPost Admin", - "from_address": "admin@scipost.org", - "context_object": "prosfel" -} -- GitLab