From cc52931956ef04166d7188450643f350fec653f4 Mon Sep 17 00:00:00 2001 From: Keannu Bernasol Date: Tue, 15 Aug 2023 14:14:26 +0800 Subject: [PATCH] Fixed subject names still having \r symbols in them and fixed student status list view not working --- stude/student_status/serializers.py | 2 +- stude/student_status/views.py | 4 ++-- stude/subjects/models.py | 2 +- 3 files changed, 4 insertions(+), 4 deletions(-) diff --git a/stude/student_status/serializers.py b/stude/student_status/serializers.py index ba9630e..ebf54ab 100644 --- a/stude/student_status/serializers.py +++ b/stude/student_status/serializers.py @@ -17,7 +17,7 @@ class StudentStatusSerializer(serializers.ModelSerializer): class Meta: model = StudentStatus - fields = '__all__' + fields = ['user', 'subject', 'location', 'active', 'landmark'] read_only_fields = ['user', 'landmark'] def create(self, validated_data): diff --git a/stude/student_status/views.py b/stude/student_status/views.py index c300f9b..96d36f7 100644 --- a/stude/student_status/views.py +++ b/stude/student_status/views.py @@ -22,8 +22,8 @@ class StudentStatusAPIView(generics.RetrieveUpdateAPIView): class ActiveStudentStatusListAPIView(generics.ListAPIView): serializer_class = StudentStatusSerializer - permission_classes = [IsAuthenticated] + # permission_classes = [IsAuthenticated] def get_queryset(self): user = self.request.user - return StudentStatus.objects.filter(user != user).filter(active=True) + return StudentStatus.objects.filter(active=True and user != user) diff --git a/stude/subjects/models.py b/stude/subjects/models.py index a1e4489..f6f86ac 100644 --- a/stude/subjects/models.py +++ b/stude/subjects/models.py @@ -58,7 +58,7 @@ def populate_subjects(sender, **kwargs): subject_year_level = year_term[0].strip() subject_semester = year_term[1].strip() subject_code = row[1] - subject_name = row[2].replace("\n", " ") + subject_name = row[2].replace("\n", " ").replace("\r", "") # Definitions of subjects to ignore ignored_subject_codes = ['NSTP', 'ROTC', 'CWTS', 'LTS']