Skip to content
GitLab
Explore
Sign in
Primary navigation
Search or go to…
Project
A
AlekSIS-App-Alsijil
Manage
Activity
Members
Labels
Plan
Issues
Issue boards
Milestones
Wiki
Code
Merge requests
Repository
Branches
Commits
Tags
Repository graph
Compare revisions
Snippets
Build
Pipelines
Jobs
Pipeline schedules
Artifacts
Deploy
Releases
Container Registry
Model registry
Operate
Environments
Monitor
Incidents
Service Desk
Analyze
Value stream analytics
Contributor analytics
CI/CD analytics
Repository analytics
Model experiments
Help
Help
Support
GitLab documentation
Compare GitLab plans
Community forum
Contribute to GitLab
Provide feedback
Terms and privacy
Keyboard shortcuts
?
Snippets
Groups
Projects
Show more breadcrumbs
AlekSIS®
Official
AlekSIS-App-Alsijil
Merge requests
!13
Disallow creating lesson documentation for lessons in the future. Close
#30
.
Code
Review changes
Check out branch
Download
Patches
Plain diff
Merged
Disallow creating lesson documentation for lessons in the future. Close
#30
.
30-prevent-lesson-edition-in-the-future
into
master
Overview
0
Commits
3
Pipelines
0
Changes
1
Merged
Tom Teichler
requested to merge
30-prevent-lesson-edition-in-the-future
into
master
5 years ago
Overview
0
Commits
3
Pipelines
0
Changes
1
Expand
Closes
#30 (closed)
0
0
Merge request reports
Viewing commit
3e37f4b4
Prev
Next
Show latest version
1 file
+
4
−
3
Inline
Compare changes
Side-by-side
Inline
Show whitespace changes
Show one file at a time
Verified
3e37f4b4
Fix raising error.
· 3e37f4b4
Tom Teichler
authored
5 years ago
biscuit/apps/alsijil/views.py
+
5
−
1
Options
from
collections
import
OrderedDict
from
datetime
import
date
,
timedelta
from
datetime
import
date
,
datetime
,
timedelta
from
typing
import
Optional
from
django.contrib.auth.decorators
import
login_required
from
django.core.exceptions
import
PermissionDenied
from
django.db.models
import
Count
,
Exists
,
F
,
OuterRef
,
Q
,
Sum
from
django.http
import
Http404
,
HttpRequest
,
HttpResponse
from
django.shortcuts
import
get_object_or_404
,
render
@@ -35,6 +36,9 @@ def lesson(request: HttpRequest, year: Optional[int] = None, week: Optional[int]
if
not
lesson_period
:
raise
Http404
(
_
(
'
You either selected an invalid lesson or there is currently no lesson in progress.
'
))
if
datetime
.
combine
(
wanted_week
[
lesson_period
.
period
.
weekday
-
1
],
lesson_period
.
period
.
time_start
)
<
datetime
.
now
():
raise
PermissionDenied
(
_
(
'
You are not allowed to create a lesson documentation for a lesson in the future.
'
))
context
[
'
lesson_period
'
]
=
lesson_period
context
[
'
week
'
]
=
wanted_week
context
[
'
day
'
]
=
wanted_week
[
lesson_period
.
period
.
weekday
-
1
]
Loading