Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
18 changes: 18 additions & 0 deletions FusionIIIT/applications/academic_procedures/api/views.py
Original file line number Diff line number Diff line change
Expand Up @@ -3599,6 +3599,24 @@ def apply_batch_changes(request):
student.batch_id = new_batch
student.batch = nyear
student.save()

# Sync branch, department, and specialization
try:
from applications.programme_curriculum.models_student_management import StudentBatchUpload
from applications.globals.models import DepartmentInfo
student_upload = StudentBatchUpload.objects.filter(roll_number=student.id_id).first()
if student_upload:
student_upload.branch = new_batch.discipline.name
student_upload.save()
dept_name = new_batch.discipline.acronym
department = DepartmentInfo.objects.filter(name=dept_name).first()
if department:
student.id.department = department
student.id.save()
student.specialization = dept_name
student.save()
except:
pass

if errors:
return Response({"errors": errors}, status=status.HTTP_207_MULTI_STATUS)
Expand Down
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
from rest_framework import serializers
from applications.programme_curriculum.models import Programme, Discipline, Curriculum, Semester, Course, Batch, CourseSlot, CourseInstructor
from applications.programme_curriculum.models_student_management import StudentBatchUpload

# this is for Programme model ....

Expand Down Expand Up @@ -122,3 +123,8 @@ class ProgrammePostSerializer(serializers.ModelSerializer):
class Meta:
model = Programme
fields = ['id', 'category', 'name', 'programme_begin_year']

class StudentBatchUploadSerializer(serializers.ModelSerializer):
class Meta:
model = StudentBatchUpload
fields = '__all__'
Loading