Skip to content
GitLab
Explore
Sign in
Primary navigation
Search or go to…
Project
A
AlekSIS-App-Chronos
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-Chronos
Commits
b9fe6f5f
Verified
Commit
b9fe6f5f
authored
2 years ago
by
magicfelix
Browse files
Options
Downloads
Patches
Plain Diff
Show only teachers in Substituion forms
parent
f6ec9c07
No related branches found
No related tags found
1 merge request
!283
Resolve "Substitution form allows selecting students"
Changes
2
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
aleksis/apps/chronos/forms.py
+11
-0
11 additions, 0 deletions
aleksis/apps/chronos/forms.py
aleksis/apps/chronos/views.py
+4
-2
4 additions, 2 deletions
aleksis/apps/chronos/views.py
with
15 additions
and
2 deletions
aleksis/apps/chronos/forms.py
+
11
−
0
View file @
b9fe6f5f
...
...
@@ -4,6 +4,7 @@ from django_select2.forms import ModelSelect2MultipleWidget, ModelSelect2Widget
from
material
import
Layout
from
.models
import
AutomaticPlan
,
LessonSubstitution
,
SupervisionSubstitution
from
.util.chronos_helpers
import
get_teachers
class
LessonSubstitutionForm
(
forms
.
ModelForm
):
...
...
@@ -23,6 +24,11 @@ class LessonSubstitutionForm(forms.ModelForm):
),
}
def
__init__
(
self
,
request
,
*
args
,
**
kwargs
):
super
().
__init__
(
*
args
,
**
kwargs
)
self
.
request
=
request
self
.
fields
[
"
teachers
"
].
queryset
=
get_teachers
(
request
.
user
)
class
SupervisionSubstitutionForm
(
forms
.
ModelForm
):
"""
Form to manage supervisions substitutions.
"""
...
...
@@ -41,6 +47,11 @@ class SupervisionSubstitutionForm(forms.ModelForm):
),
}
def
__init__
(
self
,
request
,
*
args
,
**
kwargs
):
super
().
__init__
(
*
args
,
**
kwargs
)
self
.
request
=
request
self
.
fields
[
"
teacher
"
].
queryset
=
get_teachers
(
request
.
user
)
class
AutomaticPlanForm
(
forms
.
ModelForm
):
layout
=
Layout
(
"
slug
"
,
"
name
"
,
"
number_of_days
"
,
"
show_header_box
"
)
...
...
This diff is collapsed.
Click to expand it.
aleksis/apps/chronos/views.py
+
4
−
2
View file @
b9fe6f5f
...
...
@@ -276,10 +276,11 @@ def edit_substitution(request: HttpRequest, id_: int, week: int) -> HttpResponse
if
lesson_substitution
:
edit_substitution_form
=
LessonSubstitutionForm
(
request
.
POST
or
None
,
instance
=
lesson_substitution
request
,
request
.
POST
or
None
,
instance
=
lesson_substitution
)
else
:
edit_substitution_form
=
LessonSubstitutionForm
(
request
,
request
.
POST
or
None
,
)
...
...
@@ -410,10 +411,11 @@ def edit_supervision_substitution(request: HttpRequest, id_: int, week: int) ->
if
supervision_substitution
:
edit_supervision_substitution_form
=
SupervisionSubstitutionForm
(
request
.
POST
or
None
,
instance
=
supervision_substitution
request
,
request
.
POST
or
None
,
instance
=
supervision_substitution
)
else
:
edit_supervision_substitution_form
=
SupervisionSubstitutionForm
(
request
,
request
.
POST
or
None
,
)
...
...
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