Skip to content
Snippets Groups Projects
Verified Commit 6440c8a2 authored by Jonathan Weth's avatar Jonathan Weth :keyboard:
Browse files

Allow teachers to open lesson periods in the future if they are on the same day

parent f29159e1
No related branches found
No related tags found
1 merge request!83Resolve "Allow teachers opening lessons on the same day before they start"
Pipeline #3463 passed
......@@ -27,3 +27,16 @@ class CarryOverDataToNextPeriods(BooleanPreference):
help_text = _(
"This will carry over data only if the data in the following periods are empty."
)
@site_preferences_registry.register
class AllowOpenPeriodsOnSameDay(BooleanPreference):
section = alsijil
name = "open_periods_same_day"
default = False
verbose_name = _(
"Allow teachers to open lesson periods on the same day and not just at the beginning of the period"
)
help_text = _(
"Lessons in the past are not affected by this setting, you can open them whenever you want."
)
......@@ -83,6 +83,10 @@ def lesson(
wanted_week[lesson_period.period.weekday], lesson_period.period.time_start,
)
> datetime.now()
and not (
get_site_preferences()["alsijil__open_periods_same_day"]
and wanted_week[lesson_period.period.weekday] <= datetime.now().date()
)
and not request.user.is_superuser
):
raise PermissionDenied(
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment