diff --git a/src/involvement/cron.py b/src/involvement/cron.py index f63ffc14..bdec72fa 100644 --- a/src/involvement/cron.py +++ b/src/involvement/cron.py @@ -72,8 +72,8 @@ def send_extension_emails(): def remove_old_applications(): old_applications = Application.objects.filter( position__recruitment_end__lte=date.today() - timedelta(days=7) - ).exclude( - status='appointed' + ).filter( + status='turned_down' ) for app in old_applications: diff --git a/src/involvement/forms/appointment_form.py b/src/involvement/forms/appointment_form.py index 873ce89a..32dcea9a 100644 --- a/src/involvement/forms/appointment_form.py +++ b/src/involvement/forms/appointment_form.py @@ -4,6 +4,7 @@ from involvement.models import Application from utils.forms import AdvancedModelMultipleChoiceField from utils.unicore_client import UnicoreClient +from involvement import cron class AppointmentForm(forms.Form): @@ -99,3 +100,4 @@ def save(self): if not created: appl.status = 'appointed' appl.save() + cron.remove_old_applications()