diff --git a/aleksis/apps/alsijil/schema/personal_note.py b/aleksis/apps/alsijil/schema/personal_note.py new file mode 100644 index 0000000000000000000000000000000000000000..689bb5b7f73c08c3d8961dcc9230df677e20b383 --- /dev/null +++ b/aleksis/apps/alsijil/schema/personal_note.py @@ -0,0 +1,23 @@ +from graphene_django.types import DjangoObjectType +from guardian.shortcuts import get_objects_for_user + +from aleksis.core.schema.base import ( + DjangoFilterMixin, + PermissionBatchPatchMixin, + PermissionsTypeMixin, +) + +from ..models import ExtraMark + +class ExtraMarkType(PermissionsTypeMixin, DjangoFilterMixin, DjangoObjectType): + class Meta: + model = ExtraMark + fields = ("id", "short_name", "name", "colour_fg", "colour_bg", "show_in_coursebook") + filter_fields = { + "short_name": ["icontains", "exact"], + "name": ["icontains", "exact"], + } + + @classmethod + def get_queryset(cls, queryset, info): + return get_objects_for_user(info.context.user, "alsijil.view_extramark", queryset)