Skip to content
Snippets Groups Projects
Commit 19ac25fc authored by Nik | Klampfradler's avatar Nik | Klampfradler
Browse files

Merge branch '95-allow-teachers-opening-lessons-on-the-same-day-before-they-start' into 'master'

Resolve "Allow teachers opening lessons on the same day before they start"

Closes #95

See merge request !83
parents 34107e65 4efc5015
No related branches found
No related tags found
1 merge request!83Resolve "Allow teachers opening lessons on the same day before they start"
Pipeline #3473 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