Skip to content
Snippets Groups Projects

Resolve "Adapt to active school term"

Merged magicfelix requested to merge 319-adapt-to-active-school-term into master
2 files
+ 10
1
Compare changes
  • Side-by-side
  • Inline
Files
2
from django.core.exceptions import PermissionDenied
import graphene
from graphene_django import bypass_get_queryset
from graphene_django.types import DjangoObjectType
from reversion import create_revision, set_comment, set_user
@@ -61,12 +62,14 @@ class DocumentationType(PermissionsTypeMixin, DjangoFilterMixin, DjangoObjectTyp
old_id = graphene.ID(required=False)
@staticmethod
@bypass_get_queryset
def resolve_amends(root: Documentation, info, **kwargs):
if hasattr(root, "_amends_prefetched"):
return root._amends_prefetched
return root.amends
@staticmethod
@bypass_get_queryset
def resolve_teachers(root: Documentation, info, **kwargs):
if not str(root.pk).startswith("DUMMY") and hasattr(root, "teachers"):
return root.teachers
@@ -105,6 +108,7 @@ class DocumentationType(PermissionsTypeMixin, DjangoFilterMixin, DjangoObjectTyp
)
@staticmethod
@bypass_get_queryset
def resolve_participations(root: Documentation, info, **kwargs):
# A dummy documentation will not have any participations
if str(root.pk).startswith("DUMMY") or not hasattr(root, "participations"):
Loading