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
d77a165f
Verified
Commit
d77a165f
authored
7 months ago
by
Jonathan Weth
Browse files
Options
Downloads
Patches
Plain Diff
Set correct base mutations for amend mutations
parent
3c2a4aa0
No related branches found
No related tags found
1 merge request
!315
Resolve "Substitutions PDF for new data model"
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
aleksis/apps/chronos/schema/__init__.py
+10
-8
10 additions, 8 deletions
aleksis/apps/chronos/schema/__init__.py
with
10 additions
and
8 deletions
aleksis/apps/chronos/schema/__init__.py
+
10
−
8
View file @
d77a165f
...
@@ -2,13 +2,13 @@ from datetime import timezone
...
@@ -2,13 +2,13 @@ from datetime import timezone
import
graphene
import
graphene
from
graphene_django
import
DjangoObjectType
from
graphene_django
import
DjangoObjectType
from
graphene_django_cud.mutations
import
(
DjangoBatchCreateMutation
,
DjangoBatchDeleteMutation
,
DjangoBatchPatchMutation
,
)
from
aleksis.core.models
import
Group
,
Person
,
Room
from
aleksis.core.models
import
Group
,
Person
,
Room
from
aleksis.core.schema.base
import
(
BaseBatchCreateMutation
,
BaseBatchDeleteMutation
,
BaseBatchPatchMutation
,
)
from
..models
import
LessonEvent
from
..models
import
LessonEvent
from
..util.chronos_helpers
import
get_groups
,
get_rooms
,
get_teachers
from
..util.chronos_helpers
import
get_groups
,
get_rooms
,
get_teachers
...
@@ -80,7 +80,7 @@ class DatetimeTimezoneMixin:
...
@@ -80,7 +80,7 @@ class DatetimeTimezoneMixin:
return
value
return
value
class
AmendLessonBatchCreateMutation
(
DatetimeTimezoneMixin
,
Django
BatchCreateMutation
):
class
AmendLessonBatchCreateMutation
(
DatetimeTimezoneMixin
,
Base
BatchCreateMutation
):
class
Meta
:
class
Meta
:
model
=
LessonEvent
model
=
LessonEvent
permissions
=
(
"
chronos.edit_substitution_rule
"
,)
permissions
=
(
"
chronos.edit_substitution_rule
"
,)
...
@@ -98,12 +98,13 @@ class AmendLessonBatchCreateMutation(DatetimeTimezoneMixin, DjangoBatchCreateMut
...
@@ -98,12 +98,13 @@ class AmendLessonBatchCreateMutation(DatetimeTimezoneMixin, DjangoBatchCreateMut
@classmethod
@classmethod
def
before_save
(
cls
,
root
,
info
,
input
,
created_objects
):
# noqa: A002
def
before_save
(
cls
,
root
,
info
,
input
,
created_objects
):
# noqa: A002
super
().
before_save
(
root
,
info
,
input
,
created_objects
)
for
obj
in
created_objects
:
for
obj
in
created_objects
:
obj
.
timezone
=
obj
.
amends
.
timezone
obj
.
timezone
=
obj
.
amends
.
timezone
return
created_objects
return
created_objects
class
AmendLessonBatchPatchMutation
(
DatetimeTimezoneMixin
,
Django
BatchPatchMutation
):
class
AmendLessonBatchPatchMutation
(
DatetimeTimezoneMixin
,
Base
BatchPatchMutation
):
class
Meta
:
class
Meta
:
model
=
LessonEvent
model
=
LessonEvent
permissions
=
(
"
chronos.edit_substitution_rule
"
,)
permissions
=
(
"
chronos.edit_substitution_rule
"
,)
...
@@ -111,12 +112,13 @@ class AmendLessonBatchPatchMutation(DatetimeTimezoneMixin, DjangoBatchPatchMutat
...
@@ -111,12 +112,13 @@ class AmendLessonBatchPatchMutation(DatetimeTimezoneMixin, DjangoBatchPatchMutat
@classmethod
@classmethod
def
before_save
(
cls
,
root
,
info
,
input
,
updated_objects
):
# noqa: A002
def
before_save
(
cls
,
root
,
info
,
input
,
updated_objects
):
# noqa: A002
super
().
before_save
(
root
,
info
,
input
,
updated_objects
)
for
obj
in
updated_objects
:
for
obj
in
updated_objects
:
obj
.
timezone
=
obj
.
amends
.
timezone
obj
.
timezone
=
obj
.
amends
.
timezone
return
updated_objects
return
updated_objects
class
AmendLessonBatchDeleteMutation
(
Django
BatchDeleteMutation
):
class
AmendLessonBatchDeleteMutation
(
Base
BatchDeleteMutation
):
class
Meta
:
class
Meta
:
model
=
LessonEvent
model
=
LessonEvent
permissions
=
(
"
chronos.delete_substitution_rule
"
,)
permissions
=
(
"
chronos.delete_substitution_rule
"
,)
...
...
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