mirror of
https://github.com/lemeow125/StudE-Backend.git
synced 2024-11-17 06:19:24 +08:00
Improved subject viewset
This commit is contained in:
parent
8537b1d3ac
commit
83b817ec35
1 changed files with 2 additions and 2 deletions
|
@ -17,7 +17,7 @@ class SubjectByCourseView(generics.ListAPIView):
|
|||
def get(self, request, course_slug):
|
||||
# Retrieve the subjects based on year level and semester slugs
|
||||
subjects = Subject.objects.filter(
|
||||
courses__shortname=course_slug).order_by('-subjectyearlevel')
|
||||
courses__shortname=course_slug).distinct()
|
||||
|
||||
# Serialize the subjects
|
||||
serializer = SubjectSerializer(subjects, many=True)
|
||||
|
@ -32,7 +32,7 @@ class SubjectByCourseYearSemesterView(generics.ListAPIView):
|
|||
def get(self, request, course_slug, year_slug, semester_slug):
|
||||
# Retrieve the subjects based on year level and semester slugs
|
||||
subjects = Subject.objects.filter(
|
||||
courses__shortname=course_slug, year_levels__shortname=year_slug, semesters__shortname=semester_slug)
|
||||
courses__shortname=course_slug, year_levels__shortname=year_slug, semesters__shortname=semester_slug).distinct()
|
||||
|
||||
# Serialize the subjects
|
||||
serializer = SubjectSerializer(subjects, many=True)
|
||||
|
|
Loading…
Reference in a new issue