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
Commits
28a358fa
Verified
Commit
28a358fa
authored
5 years ago
by
Nik | Klampfradler
Browse files
Options
Downloads
Patches
Plain Diff
Use a redirect after determining current lesson. Closes
#33
.
parent
89e79a55
No related branches found
No related tags found
No related merge requests found
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
biscuit/apps/alsijil/views.py
+5
-3
5 additions, 3 deletions
biscuit/apps/alsijil/views.py
with
5 additions
and
3 deletions
biscuit/apps/alsijil/views.py
+
5
−
3
View file @
28a358fa
...
...
@@ -6,7 +6,7 @@ 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
from
django.shortcuts
import
get_object_or_404
,
redirect
,
render
from
django.urls
import
reverse
from
django.utils.translation
import
ugettext
as
_
from
django.views.decorators.cache
import
cache_page
...
...
@@ -33,8 +33,10 @@ def lesson(request: HttpRequest, year: Optional[int] = None, week: Optional[int]
Q
(
substitutions__teachers
=
request
.
user
.
person
)
|
Q
(
lesson__teachers
=
request
.
user
.
person
)).
first
()
wanted_week
=
CalendarWeek
()
if
not
lesson_period
:
raise
Http404
(
_
(
'
You either selected an invalid lesson or there is currently no lesson in progress.
'
))
if
lesson_period
:
return
redirect
(
'
lesson_by_week_and_period
'
,
wanted_week
.
year
,
wanted_week
.
week
,
lesson_period
.
pk
)
else
:
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.
'
))
...
...
This diff is collapsed.
Click to expand it.
Preview
0%
Loading
Try again
or
attach a new file
.
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Save comment
Cancel
Please
register
or
sign in
to comment