Skip to content
Snippets Groups Projects
Commit ba7c95f9 authored by ml bonhomme's avatar ml bonhomme :bee: Committed by Erwan Rouchet
Browse files

Fix TypeError when retrieving a model version you don't have access to

parent 9d1cf983
No related branches found
No related tags found
1 merge request!1987Fix TypeError when retrieving a model version you don't have access to
......@@ -128,8 +128,9 @@ class ModelVersionsRetrieve(TrainingModelMixin, RetrieveUpdateDestroyAPIView):
def get_serializer_context(self):
context = super().get_serializer_context()
access_level = getattr(self, 'access_level', None)
context.update({
'is_contributor': getattr(self, 'access_level', 0) >= Role.Contributor.value,
'is_contributor': access_level is not None and access_level >= Role.Contributor.value,
})
return context
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment