Fixed subject names still having \r symbols in them and fixed student status list view not working

This commit is contained in:
Keannu Bernasol 2023-08-15 14:14:26 +08:00
parent e734afd631
commit cc52931956
3 changed files with 4 additions and 4 deletions

View file

@ -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):

View file

@ -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)

View file

@ -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']