Skip to content
GitLab
Explore
Sign in
Primary navigation
Search or go to…
Project
A
AlekSIS-App-Kolego
Manage
Activity
Members
Labels
Plan
Issues
Issue boards
Milestones
Wiki
Code
Merge requests
Repository
Branches
Commits
Tags
Repository graph
Compare revisions
Build
Pipelines
Jobs
Pipeline schedules
Artifacts
Deploy
Releases
Package Registry
Model registry
Operate
Environments
Terraform modules
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®
Onboarding
AlekSIS-App-Kolego
Commits
faedae34
Commit
faedae34
authored
3 months ago
by
magicfelix
Browse files
Options
Downloads
Patches
Plain Diff
Fix return annotations and use staticmethod
parent
ad605e22
No related branches found
Branches containing commit
No related tags found
1 merge request
!55
Fix return annotations and use staticmethod
Pipeline
#194017
passed
3 months ago
Stage: prepare
Stage: test
Stage: build
Changes
1
Pipelines
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
aleksis/apps/kolego/schema/__init__.py
+10
-4
10 additions, 4 deletions
aleksis/apps/kolego/schema/__init__.py
with
10 additions
and
4 deletions
aleksis/apps/kolego/schema/__init__.py
+
10
−
4
View file @
faedae34
from
django.apps
import
apps
from
django.db.models
import
QuerySet
import
graphene
import
graphene_django_optimizer
...
...
@@ -31,10 +32,12 @@ class Query(graphene.ObjectType):
absence_reason_tags
=
FilterOrderList
(
AbsenceReasonTagType
)
all_absence_reason_tags
=
FilterOrderList
(
AbsenceReasonTagType
)
@staticmethod
def
resolve_app_name
(
root
,
info
,
**
kwargs
)
->
str
:
return
apps
.
get_app_config
(
"
kolego
"
).
verbose_name
def
resolve_absences
(
root
,
info
,
**
kwargs
)
->
str
:
@staticmethod
def
resolve_absences
(
root
,
info
,
**
kwargs
)
->
QuerySet
:
return
graphene_django_optimizer
.
query
(
get_objects_for_user
(
info
.
context
.
user
,
...
...
@@ -44,7 +47,8 @@ class Query(graphene.ObjectType):
info
,
)
def
resolve_absencereasons
(
root
,
info
,
**
kwargs
)
->
str
:
@staticmethod
def
resolve_absencereasons
(
root
,
info
,
**
kwargs
)
->
QuerySet
:
if
not
info
.
context
.
user
.
has_perm
(
"
kolego.fetch_absencereasons_rule
"
):
return
[]
return
graphene_django_optimizer
.
query
(
...
...
@@ -56,7 +60,8 @@ class Query(graphene.ObjectType):
info
,
)
def
resolve_absence_reason_tags
(
root
,
info
,
**
kwargs
):
@staticmethod
def
resolve_absence_reason_tags
(
root
,
info
,
**
kwargs
)
->
QuerySet
:
return
graphene_django_optimizer
.
query
(
get_objects_for_user
(
info
.
context
.
user
,
...
...
@@ -66,7 +71,8 @@ class Query(graphene.ObjectType):
info
,
)
def
resolve_all_absence_reason_tags
(
root
,
info
,
**
kwargs
):
@staticmethod
def
resolve_all_absence_reason_tags
(
root
,
info
,
**
kwargs
)
->
QuerySet
:
return
graphene_django_optimizer
.
query
(
get_objects_for_user
(
info
.
context
.
user
,
...
...
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