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
31fed539
Verified
Commit
31fed539
authored
4 years ago
by
Jonathan Weth
Browse files
Options
Downloads
Patches
Plain Diff
Rename get_instance_by_pk and document it better
parent
3d5d957c
No related branches found
No related tags found
1 merge request
!49
Resolve "Add rules and permissions"
Pipeline
#4071
failed
4 years ago
Stage: test
Stage: build
Changes
2
Pipelines
1
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
aleksis/apps/alsijil/util/alsijil_helpers.py
+2
-2
2 additions, 2 deletions
aleksis/apps/alsijil/util/alsijil_helpers.py
aleksis/apps/alsijil/views.py
+3
-3
3 additions, 3 deletions
aleksis/apps/alsijil/views.py
with
5 additions
and
5 deletions
aleksis/apps/alsijil/util/alsijil_helpers.py
+
2
−
2
View file @
31fed539
...
...
@@ -38,14 +38,14 @@ def get_lesson_period_by_pk(
return
lesson_period
def
get_instance_by_pk
(
def
get_
timetable_
instance_by_pk
(
request
:
HttpRequest
,
year
:
Optional
[
int
]
=
None
,
week
:
Optional
[
int
]
=
None
,
type_
:
Optional
[
str
]
=
None
,
id_
:
Optional
[
int
]
=
None
,
):
"""
Get
Instance object
by given type and id or the current person.
"""
"""
Get
timetable object (teacher, room or group)
by given type and id or the current person.
"""
if
type_
and
id_
:
return
get_el_by_pk
(
request
,
type_
,
id_
)
elif
hasattr
(
request
,
"
user
"
)
and
hasattr
(
request
.
user
,
"
person
"
):
...
...
This diff is collapsed.
Click to expand it.
aleksis/apps/alsijil/views.py
+
3
−
3
View file @
31fed539
...
...
@@ -34,7 +34,7 @@ from .forms import (
)
from
.models
import
ExcuseType
,
ExtraMark
,
LessonDocumentation
,
PersonalNote
from
.tables
import
ExcuseTypeTable
,
ExtraMarkTable
from
.util.alsijil_helpers
import
get_
instance_by_pk
,
get_lesson_period
_by_pk
from
.util.alsijil_helpers
import
get_
lesson_period_by_pk
,
get_timetable_instance
_by_pk
@permission_required
(
"
alsijil.view_lesson
"
,
fn
=
get_lesson_period_by_pk
)
...
...
@@ -162,7 +162,7 @@ def lesson(
return
render
(
request
,
"
alsijil/class_register/lesson.html
"
,
context
)
@permission_required
(
"
alsijil.view_week
"
,
fn
=
get_instance_by_pk
)
@permission_required
(
"
alsijil.view_week
"
,
fn
=
get_
timetable_
instance_by_pk
)
def
week_view
(
request
:
HttpRequest
,
year
:
Optional
[
int
]
=
None
,
...
...
@@ -177,7 +177,7 @@ def week_view(
else
:
wanted_week
=
CalendarWeek
()
instance
=
get_instance_by_pk
(
request
,
year
,
week
,
type_
,
id_
)
instance
=
get_
timetable_
instance_by_pk
(
request
,
year
,
week
,
type_
,
id_
)
lesson_periods
=
LessonPeriod
.
objects
.
in_week
(
wanted_week
).
annotate
(
has_documentation
=
Exists
(
...
...
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