diff --git a/aleksis/apps/alsijil/util/predicates.py b/aleksis/apps/alsijil/util/predicates.py index f3b5ad5901db996e928d44b6e8a6edfb41e207b6..9f06195e279b6e9bc9564731146d33ea7995498d 100644 --- a/aleksis/apps/alsijil/util/predicates.py +++ b/aleksis/apps/alsijil/util/predicates.py @@ -2,7 +2,7 @@ from typing import Any, Union from django.contrib.auth.models import User from django.db.models import Q -from django.utils.timezone import localdate, localtime +from django.utils.timezone import localdate, now from rules import predicate @@ -481,11 +481,11 @@ def is_in_allowed_time_range(user: User, obj: Documentation): get_site_preferences()["alsijil__allow_edit_future_documentations"] == "all" or ( get_site_preferences()["alsijil__allow_edit_future_documentations"] == "current_day" - and obj.datetime_start.date() <= localdate() + and obj.value_start_datetime(obj).date() <= localdate() ) or ( get_site_preferences()["alsijil__allow_edit_future_documentations"] == "current_time" - and obj.datetime_start <= localtime() + and obj.value_start_datetime(obj) <= now() ) ): return True @@ -495,6 +495,6 @@ def is_in_allowed_time_range(user: User, obj: Documentation): @predicate def is_in_allowed_time_range_for_participation_status(user: User, obj: Documentation): """Predicate which checks if the documentation is in the allowed time range for editing.""" - if obj and obj.datetime_start <= localtime(): + if obj and obj.value_start_datetime(obj) <= now(): return True return False