diff --git a/castellum/studies/management/commands/delete_filter_trials.py b/castellum/studies/management/commands/cleanup_filter_trials.py
similarity index 100%
rename from castellum/studies/management/commands/delete_filter_trials.py
rename to castellum/studies/management/commands/cleanup_filter_trials.py
diff --git a/castellum/subjects/management/commands/cleanup_availability.py b/castellum/subjects/management/commands/cleanup_availability.py
new file mode 100644
index 0000000000000000000000000000000000000000..4b938f6505a9a4c837fdfcecbddc9f71c08f2eba
--- /dev/null
+++ b/castellum/subjects/management/commands/cleanup_availability.py
@@ -0,0 +1,36 @@
+# (c) 2018-2021
+# MPIB ,
+# MPI-CBS ,
+# MPIP
+#
+# This file is part of Castellum.
+#
+# Castellum is free software; you can redistribute it and/or modify it
+# under the terms of the GNU Affero General Public License as published
+# by the Free Software Foundation; either version 3 of the License, or
+# (at your option) any later version.
+#
+# Castellum is distributed in the hope that it will be useful, but
+# WITHOUT ANY WARRANTY; without even the implied warranty of
+# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+# Affero General Public License for more details.
+#
+# You should have received a copy of the GNU Affero General Public
+# License along with Castellum. If not, see
+# .
+
+from django.core.management.base import BaseCommand
+from django.utils import timezone
+
+from castellum.subjects.models import Subject
+
+
+class Command(BaseCommand):
+ help = 'Remove obsolete "not available until" entries.'
+
+ def handle(self, *args, **options):
+ now = timezone.now()
+ subjects = Subject.objects.filter(not_available_until__lt=now)
+ count = subjects.update(not_available_until=None)
+ if options['verbosity'] > 0 and count > 0:
+ self.stdout.write('Cleared {} "not available until" entries'.format(count))
diff --git a/docs/deployment.md b/docs/deployment.md
index e842e3df0d19303ccf4d31982b11ee5b132bf05e..d17dbaae9eeca61d3c5ecde811ad78c6185f1e0c 100644
--- a/docs/deployment.md
+++ b/docs/deployment.md
@@ -79,15 +79,17 @@ user requests. We provide the following management commands for that:
- `clearsessions`: Delete expired sessions.
- `cleanup_media`: Delete unused uploaded files.
+- `cleanup_availability`: Remove obsolete "not available until"
+ entries.
+- `cleanup_filter_trials`: Delete filter trials as they are meant to be
+ used only once.
- `notify_to_be_deleted`: Automatically notify about content that
should be deleted.
+- `notify_sessions_end`: Remind study members to finish a study when
+ sessions end.
- `send_appointment_reminders`: Send email reminders to subjects with
upcoming appointments. If the subjects have no email address, a note
is sent to the respective study coordinators instead.
-- `notify_sessions_end`: Remind study members to finish a study when
- sessions end.
-- `delete_filter_trials`: Delete filter trials as they are meant to be
- used only once.
## Initial setup
diff --git a/docs/example_deployment/crontab b/docs/example_deployment/crontab
index 428e9958601df98b41bf2754245909fd24897111..9ca976c8418470874e2d975065bc4a08ea7e8d29 100644
--- a/docs/example_deployment/crontab
+++ b/docs/example_deployment/crontab
@@ -1,8 +1,9 @@
# min hour day month weekday command
0 1 * * * django-admin clearsessions
1 1 * * * django-admin cleanup_media
-2 1 * * * django-admin notify_to_be_deleted http://example.com
-3 1 * * * django-admin send_appointment_reminders http://example.com
-4 1 * * * django-admin notify_sessions_end
-5 1 * * * django-admin delete_filter_trials
-6 1 * * 1 django-admin geocode_all
+2 1 * * * django-admin cleanup_availability
+3 1 * * * django-admin cleanup_filter_trials
+4 1 * * * django-admin notify_to_be_deleted http://example.com
+5 1 * * * django-admin notify_sessions_end
+6 1 * * * django-admin send_appointment_reminders http://example.com
+7 1 * * 1 django-admin geocode_all
diff --git a/tests/studies/management_commands/test_delete_filter_trials.py b/tests/studies/management_commands/test_cleanup_filter_trials.py
similarity index 72%
rename from tests/studies/management_commands/test_delete_filter_trials.py
rename to tests/studies/management_commands/test_cleanup_filter_trials.py
index b9d939e1da10a7ae5fbb773bbd8af57385a1f89e..41c7b99a6b3797b931cd0bf33a5e4931e5003b74 100644
--- a/tests/studies/management_commands/test_delete_filter_trials.py
+++ b/tests/studies/management_commands/test_cleanup_filter_trials.py
@@ -1,10 +1,10 @@
from model_bakery import baker
-from castellum.studies.management.commands.delete_filter_trials import Command
+from castellum.studies.management.commands.cleanup_filter_trials import Command
from castellum.studies.models import Study
-def test_delete_filter_trial(study):
+def test_cleanup_filter_trial(study):
baker.make(Study, is_filter_trial=True)
cmd = Command()