Skip to content

Commit e14ff33

Browse files
committed
List hidden modules to teachers and admins in the API
Fixes #1522
1 parent de96d79 commit e14ff33

1 file changed

Lines changed: 2 additions & 1 deletion

File tree

course/api/views.py

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -486,6 +486,7 @@ def __module_to_dict(self, module: ModuleContent, **kwargs) -> Dict[str, Any]:
486486
module.opening_time,
487487
module.closing_time,
488488
),
489+
'is_hidden': module.status == CourseModule.STATUS.HIDDEN,
489490
'reading_opening_time': module.reading_opening_time,
490491
'opening_time': module.opening_time,
491492
'closing_time': module.closing_time,
@@ -496,7 +497,7 @@ def __module_to_dict(self, module: ModuleContent, **kwargs) -> Dict[str, Any]:
496497
def list(self, request, *args, **kwargs) -> Response:
497498
modules = []
498499
for module in self.content.data.modules:
499-
if module.is_visible():
500+
if module.is_visible() or self.is_teacher:
500501
modules.append(self.__module_to_dict(module, **kwargs))
501502
return Response({"count": len(modules), "next": None, "previous": None, 'results': modules})
502503

0 commit comments

Comments
 (0)