From 181b94e27bfe0a4161608090d98a83184cc4e1f6 Mon Sep 17 00:00:00 2001 From: Divyanshu Sharma <21bcs079@iiitdmj.ac.in> Date: Mon, 22 Apr 2024 17:00:21 +0530 Subject: [PATCH] working_year column insertions --- .../applications/academic_procedures/views.py | 19 ++++++++++++------- 1 file changed, 12 insertions(+), 7 deletions(-) diff --git a/FusionIIIT/applications/academic_procedures/views.py b/FusionIIIT/applications/academic_procedures/views.py index 416992134..f5d9052ca 100644 --- a/FusionIIIT/applications/academic_procedures/views.py +++ b/FusionIIIT/applications/academic_procedures/views.py @@ -41,7 +41,7 @@ from django.db.models.functions import Concat,ExtractYear,ExtractMonth,ExtractDay,Cast from .api import serializers from django.core.serializers import serialize - +import datetime """every newfuncitons that have been created with name auto_ in start of their original name is to implement new logic of registraion .. unlike the previous registration logic that was done with priority """ @@ -1050,7 +1050,7 @@ def acad_add_course(request): sem_id = request.POST['semester_id'] semester = Semester.objects.get(id=sem_id) cr = course_registration( - course_id=course, student_id=student, semester_id=semester) + course_id=course, student_id=student, semester_id=semester , working_year = datetime.datetime.now().year,) cr.save() return HttpResponseRedirect('/academic-procedures/') @@ -1718,7 +1718,8 @@ def add_courses(request): course_id = course_id, student_id=current_user, course_slot_id = courseslot_id, - semester_id=sem_id + semester_id=sem_id, + working_year = datetime.datetime.now().year, ) if p not in reg_curr: reg_curr.append(p) @@ -1924,6 +1925,7 @@ def get_add_course_options(branch_courses, current_register, batch): if courseslot not in slots: lis = [] for course in courseslot.courses.all(): + print(course) if course_registration.objects.filter(student_id__batch_id__year = batch, course_id = course).count() < max_limit: lis.append(course) course_option.append((courseslot, lis)) @@ -2560,7 +2562,8 @@ def verify_registration(request): course_id=obj.course_id, student_id=student, semester_id=obj.semester_id, - course_slot_id = obj.course_slot_id + course_slot_id = obj.course_slot_id, + working_year = datetime.datetime.now().year, ) ver_reg.append(p) o = FinalRegistration.objects.filter(id= obj.id).update(verified = True) @@ -3836,7 +3839,8 @@ def add_one_course(request): course_id=course_id, student_id=current_user, course_slot_id=courseslot_id, - semester_id=sem_id + semester_id=sem_id, + working_year = datetime.datetime.now().year, ) p.save() return JsonResponse({'message': 'Course added successfully'}) @@ -4041,7 +4045,7 @@ def swayam_replace(request): semester_id = semester_id_model, student_id = student_id_model, course_slot_id = course_slot_id_model, - working_year = 1 + working_year = datetime.datetime.now().year, ) obj.save() @@ -4086,7 +4090,8 @@ def register_backlog_course(request): course_id=course_id, student_id=current_user, course_slot_id=course_slot_id, - semester_id=sem_id + semester_id=sem_id, + working_year = datetime.datetime.now().year, ) p.save() return JsonResponse({'message': 'Successfully Registered Backlog course' }, status=200)