refactor: Refactoring de la section ClassSection

This commit is contained in:
N3WT DE COMPET
2025-02-07 08:01:47 +01:00
parent 72dd7699d6
commit 1a8ef26f58
11 changed files with 642 additions and 486 deletions

View File

@ -3,6 +3,7 @@
# The first instruction is what image we want to base our container on
# We Use an official Python runtime as a parent image
FROM python:3.12.7
WORKDIR /Back-End
# Allows docker to cache installed dependencies between builds
COPY requirements.txt requirements.txt
@ -11,7 +12,6 @@ RUN pip install pymupdf
# Mounts the application code to the image
COPY . .
WORKDIR /Back-End
EXPOSE 8080

View File

@ -68,11 +68,7 @@ class TeacherSerializer(serializers.ModelSerializer):
def get_droit(self, obj):
if obj.associated_profile:
droit_id = obj.associated_profile.droit
return {
"label": obj.associated_profile.get_droit_display(),
"id": droit_id
}
return obj.associated_profile.droit
return None
def get_specialities_details(self, obj):
@ -163,7 +159,7 @@ class SchoolClassSerializer(serializers.ModelSerializer):
return instance
def get_teachers_details(self, obj):
return [{'last_name': teacher.last_name, 'first_name': teacher.first_name} for teacher in obj.teachers.all()]
return [{'id': teacher.id, 'last_name': teacher.last_name, 'first_name': teacher.first_name} for teacher in obj.teachers.all()]
def get_updated_date_formatted(self, obj):
utc_time = timezone.localtime(obj.updated_date)