Safely access the code property
This commit is contained in:
parent
31df04357b
commit
281b7c900c
|
|
@ -147,7 +147,7 @@ class CourseSessionUserExpertCircleType(ObjectType):
|
|||
|
||||
|
||||
class CourseSessionUserType(DjangoObjectType):
|
||||
chosen_profile = graphene.String()
|
||||
chosen_profile = graphene.String(required=True)
|
||||
course_session = graphene.Field(
|
||||
"vbv_lernwelt.course.graphql.types.CourseSessionObjectType", required=True
|
||||
)
|
||||
|
|
@ -158,7 +158,7 @@ class CourseSessionUserType(DjangoObjectType):
|
|||
|
||||
@staticmethod
|
||||
def resolve_chosen_profile(root: CourseSessionUser, info, **kwargs):
|
||||
return root.chosen_profile.code
|
||||
return getattr(root.chosen_profile, "code", "")
|
||||
|
||||
|
||||
class CourseSessionUserObjectsType(ObjectType):
|
||||
|
|
|
|||
Loading…
Reference in New Issue