Display empty courses in new class table

This commit is contained in:
2022-04-26 03:06:51 +00:00
parent b400d010e0
commit 667887c06c
4 changed files with 58 additions and 9 deletions

View File

@@ -234,6 +234,8 @@ class CardViewSet(Base, Create, Retrieve, Update, Destroy):
utils_stats.changed_card()
# TODO: return nested list of sessions, limited with Prefetch:
# https://stackoverflow.com/a/58689019
class CourseViewSet(Base, List, Retrieve, Create, Update):
permission_classes = [AllowMetadata | IsAuthenticatedOrReadOnly, IsAdminOrReadOnly | IsInstructorOrReadOnly]
queryset = models.Course.objects.annotate(date=Max('sessions__datetime')).order_by('-date')