diff --git a/.gitignore b/.gitignore
index a96bc1887..925477619 100644
--- a/.gitignore
+++ b/.gitignore
@@ -78,4 +78,8 @@ docker-entrypoint.sh
FusionIIIT/applications/eis/migrations/
-postgres_data
\ No newline at end of file
+postgres_data
+
+# sample files from media/Adminstrator
+!media/Administrator/academic_procedures/sample_courses_allotment.xls
+!media/Administrator/academic_procedures/sample_student_profile.xlsx
diff --git a/FusionIIIT/Fusion/context_processors.py b/FusionIIIT/Fusion/context_processors.py
new file mode 100644
index 000000000..54566d56e
--- /dev/null
+++ b/FusionIIIT/Fusion/context_processors.py
@@ -0,0 +1,5 @@
+def global_vars(request):
+ return {
+ 'global_var': request.session.get('currentDesignationSelected', 'default_value'),
+ 'global_var2': request.session.get('allDesignations', 'default_value2'),
+ }
\ No newline at end of file
diff --git a/FusionIIIT/Fusion/middleware/custom_middleware.py b/FusionIIIT/Fusion/middleware/custom_middleware.py
new file mode 100644
index 000000000..f77873534
--- /dev/null
+++ b/FusionIIIT/Fusion/middleware/custom_middleware.py
@@ -0,0 +1,48 @@
+# custom_middleware.py
+from django.contrib.auth.signals import user_logged_in
+from django.dispatch import receiver
+from applications.globals.models import (ExtraInfo, Feedback, HoldsDesignation,
+ Issue, IssueImage, DepartmentInfo)
+from django.shortcuts import get_object_or_404, redirect, render
+
+def user_logged_in_middleware(get_response):
+ @receiver(user_logged_in)
+ def user_logged_in_handler(sender, user, request, **kwargs):
+ if 'function_executed' not in request.session:
+ # Run the function only if the flag is not set
+ # Assuming user is a model with the desired data field, retrieve the data
+ # For example, if your User model has a field named 'custom_field', you can access it like:
+ if user.is_authenticated:
+ desig = list(HoldsDesignation.objects.select_related('user','working','designation').all().filter(working = request.user).values_list('designation'))
+ print(desig)
+ b = [i for sub in desig for i in sub]
+ design = HoldsDesignation.objects.select_related('user','designation').filter(working=request.user)
+
+ designation=[]
+
+ designation.append(str(user.extrainfo.user_type))
+ for i in design:
+ if str(i.designation) != str(user.extrainfo.user_type):
+ print('-------')
+ print(i.designation)
+ print(user.extrainfo.user_type)
+ print('')
+ designation.append(str(i.designation))
+
+ for i in designation:
+ print(i)
+
+ request.session['currentDesignationSelected'] = designation[0]
+ request.session['allDesignations'] = designation
+ print("logged iN")
+
+ # Set the flag in the session to indicate that the function has bee+n executed
+ request.session['function_executed'] = True
+
+ def middleware(request):
+ if request.user.is_authenticated:
+ user_logged_in_handler(request.user, request.user, request)
+ response = get_response(request)
+ return response
+
+ return middleware
\ No newline at end of file
diff --git a/FusionIIIT/Fusion/settings/common.py b/FusionIIIT/Fusion/settings/common.py
index b98ea6960..fabe81ec2 100644
--- a/FusionIIIT/Fusion/settings/common.py
+++ b/FusionIIIT/Fusion/settings/common.py
@@ -163,6 +163,7 @@
'django.contrib.auth.middleware.AuthenticationMiddleware',
'django.contrib.messages.middleware.MessageMiddleware',
'django.middleware.clickjacking.XFrameOptionsMiddleware',
+ 'Fusion.middleware.custom_middleware.user_logged_in_middleware',
]
ROOT_URLCONF = 'Fusion.urls'
@@ -178,6 +179,7 @@
'django.template.context_processors.request',
'django.contrib.auth.context_processors.auth',
'django.contrib.messages.context_processors.messages',
+ 'Fusion.context_processors.global_vars',
],
},
},
diff --git a/FusionIIIT/applications/academic_information/views.py b/FusionIIIT/applications/academic_information/views.py
index 8829db4f9..fd80bc848 100755
--- a/FusionIIIT/applications/academic_information/views.py
+++ b/FusionIIIT/applications/academic_information/views.py
@@ -841,14 +841,16 @@ def generatexlsheet(request):
"""
if user_check(request):
return HttpResponseRedirect('/academic-procedures/')
-
+ # print(request.POST)
try:
- batch = request.POST['batch']
- # print('-------------------------------------------------------------------------------------' , request.POST['course'])
- course_name = Course.objects.get(id = request.POST['course']).course_name
- course = Courses.objects.get(name = course_name )
+ batch = request.POST['batch']#batch hai year wala (2020 , 21)
+ course_id = int(request.POST['course']) # id of course in integer
+ course = course = Courses.objects.get(id=course_id)
+
+ # print(course.name)
obj = course_registration.objects.all().filter(course_id = course)
except Exception as e:
+ print(str(e))
batch=""
course=""
curr_key=""
@@ -2074,14 +2076,15 @@ def view_all_student_data(request):
"specailization": student.specialization,
"gender" : student.id.sex,
"category": student.category,
- "pwd_status": student.pwd_status,
+ # "pwd_status": student.pwd_status,
+ "pwd_status": False,
"Mobile": student.id.phone_no,
"dob" : student.id.date_of_birth,
"emailid" : student.id.user.email,
"father_name": student.father_name,
- "father_mobile_no": student.father_mobile_no,
+ # "father_mobile_no": student.father_mobile_no,
"mother_name": student.mother_name,
- "mother_mobile_no": student.mother_mobile_no,
+ # "mother_mobile_no": student.mother_mobile_no,
"address": student.id.address
}
data.append(obj)
@@ -2151,9 +2154,9 @@ def generatestudentxlsheet(request):
data = None
else:
if(request_rollno != ""):
- students = Student.objects.select_related('batch_id', 'id__user', 'batch_id__discipline', 'id').filter(id = request_rollno).only('batch', 'id__id', 'id__user', 'programme','pwd_status', 'father_mobile_no', 'mother_mobile_no', 'batch_id__discipline__acronym', 'specialization', 'id__sex', 'category', 'id__phone_no', 'id__date_of_birth', 'id__user__first_name', 'id__user__last_name', 'id__user__email', 'father_name', 'mother_name', 'id__address')
+ students = Student.objects.select_related('batch_id', 'id__user', 'batch_id__discipline', 'id').filter(id = request_rollno).only('batch', 'id__id', 'id__user', 'programme', 'batch_id__discipline__acronym', 'specialization', 'id__sex', 'category', 'id__phone_no', 'id__date_of_birth', 'id__user__first_name', 'id__user__last_name', 'id__user__email', 'father_name', 'mother_name', 'id__address')
else:
- students = Student.objects.select_related('batch_id', 'id__user', 'batch_id__discipline', 'id').filter(**filter_names).order_by('id').all().only('batch', 'id__id', 'id__user', 'programme','pwd_status', 'father_mobile_no', 'mother_mobile_no', 'batch_id__discipline__acronym', 'specialization', 'id__sex', 'category', 'id__phone_no', 'id__date_of_birth', 'id__user__first_name', 'id__user__last_name', 'id__user__email', 'father_name', 'mother_name', 'id__address')
+ students = Student.objects.select_related('batch_id', 'id__user', 'batch_id__discipline', 'id').filter(**filter_names).order_by('id').all().only('batch', 'id__id', 'id__user', 'programme', 'batch_id__discipline__acronym', 'specialization', 'id__sex', 'category', 'id__phone_no', 'id__date_of_birth', 'id__user__first_name', 'id__user__last_name', 'id__user__email', 'father_name', 'mother_name', 'id__address')
for i in students:
obj = []
obj.append(i.batch)
@@ -2164,14 +2167,17 @@ def generatestudentxlsheet(request):
obj.append(i.specialization)
obj.append(i.id.sex)
obj.append(i.category)
- obj.append(i.pwd_status)
+ #obj.append(i.pwd_status)
+ obj.append(None)
obj.append(i.id.phone_no)
obj.append(i.id.date_of_birth)
obj.append(i.id.user.email)
obj.append(i.father_name)
- obj.append(i.father_mobile_no)
+ #obj.append(i.father_mobile_no)
+ obj.append(None)
obj.append(i.mother_name)
- obj.append(i.mother_mobile_no)
+ # obj.append(i.mother_mobile_no)
+ obj.append(None)
obj.append(i.id.address)
data.append(obj)
data.sort()
diff --git a/FusionIIIT/applications/academic_procedures/api/urls.py b/FusionIIIT/applications/academic_procedures/api/urls.py
index a9fb2c81f..1bf63b660 100644
--- a/FusionIIIT/applications/academic_procedures/api/urls.py
+++ b/FusionIIIT/applications/academic_procedures/api/urls.py
@@ -19,7 +19,9 @@
url(r'^acad/get_course_list' , views.get_course_list , name = 'get_course_list' ),
url(r'^acad/configure_pre_registration' , views.configure_pre_registration_date , name = 'configure_pre_registration'),
url(r'^acad/configure_final_registration' , views.configure_final_registration_date , name = 'configure_final_registration'),
-
+ url(r'^acad/add_course_to_slot' , views.add_course_to_slot , name = 'add_course_to_slot'),
+ url(r'^acad/remove_course_from_slot' , views.remove_course_from_slot , name = 'remove_course_from_slot'),
+ url(r'^get_next_sem_courses' , views.get_next_sem_courses , name= 'get_next_sem_courses'),
url(r'^fac/view_assigned_courses' , views.faculty_assigned_courses , name = 'faculty_assigned_courses'),
diff --git a/FusionIIIT/applications/academic_procedures/api/views.py b/FusionIIIT/applications/academic_procedures/api/views.py
index c8ba3ce65..99a807cd4 100644
--- a/FusionIIIT/applications/academic_procedures/api/views.py
+++ b/FusionIIIT/applications/academic_procedures/api/views.py
@@ -4,6 +4,7 @@
from django.shortcuts import get_object_or_404, redirect
from django.db import transaction
+from django.http import JsonResponse
from rest_framework.permissions import IsAuthenticated
from rest_framework.authentication import TokenAuthentication
from rest_framework import status
@@ -29,6 +30,7 @@
get_pre_registration_eligibility,
get_final_registration_eligibility,
get_add_or_drop_course_date_eligibility,
+ get_detailed_sem_courses,
InitialRegistration)
from . import serializers
@@ -641,7 +643,38 @@ def configure_final_registration_date(request):
return Response(data = {"message" : "Physical Reporting at the Institute will be opened from " + str(from_date) + " to " + str(to_date) + ". " , } , status= status.HTTP_200_OK)
except Exception as e:
return Response(data = {"error " : str(e)} , status= status.HTTP_500_INTERNAL_SERVER_ERROR)
-
+
+# with this api request acad person can add any courses in a specific slot
+@api_view(['POST'])
+def add_course_to_slot(request):
+ course_code = request.data.get('course_code')
+ course_slot_name = request.data.get('course_slot_name')
+ try:
+ course_slot = CourseSlot.objects.get(name=course_slot_name)
+ course = Courses.objects.get(code=course_code)
+ course_slot.courses.add(course)
+
+ return JsonResponse({'message': f'Course {course_code} added to slot {course_slot_name} successfully.'}, status=200)
+ except CourseSlot.DoesNotExist:
+ return JsonResponse({'error': 'Course slot does not exist.'}, status=400)
+ except Course.DoesNotExist:
+ return JsonResponse({'error': 'Course does not exist.'}, status=400)
+
+# with this api request acad person can remove any course from a specific slot
+@api_view(['POST'])
+def remove_course_from_slot(request):
+ course_code = request.data.get('course_code')
+ course_slot_name = request.data.get('course_slot_name')
+ try:
+ course_slot = CourseSlot.objects.get(name=course_slot_name)
+ course = Courses.objects.get(code=course_code)
+ course_slot.courses.remove(course)
+ return JsonResponse({'message': f'Course {course_code} removed from slot {course_slot_name} successfully.'}, status=200)
+ except CourseSlot.DoesNotExist:
+ return JsonResponse({'error': 'Course slot does not exist.'}, status=400)
+ except Course.DoesNotExist:
+ return JsonResponse({'error': 'Course does not exist.'}, status=400)
+
#--------------------------------------- APIs of faculty----------------------------------------------------------
@@ -663,8 +696,25 @@ def faculty_assigned_courses(request):
return Response(data = {"error" : str(e)} , status= status.HTTP_500_INTERNAL_SERVER_ERROR)
+@api_view(['POST'])
+def get_next_sem_courses(request):
+ try:
+ next_sem = request.data.get('next_sem')
+ branch = request.data.get('branch')
+ programme = request.data.get('programme')
+ batch = request.data.get('batch')
+ # we go to student table and apply filters and get batch_id of the students with these filter
+ batch_id = Student.objects.filter(programme = programme , batch = batch , specialization = branch)[0].batch_id
+ curr_id = batch_id.curriculum
+ next_sem_id = Semester.objects.get(curriculum = curr_id, semester_no = next_sem)
+
+ if next_sem_id:
+ next_sem_registration_courses = get_detailed_sem_courses(next_sem_id )
+ return JsonResponse(next_sem_registration_courses, safe=False)
+ except Exception as e:
+ return Response(data = {"error" : str(e)} , status= status.HTTP_500_INTERNAL_SERVER_ERROR)
diff --git a/FusionIIIT/applications/academic_procedures/urls.py b/FusionIIIT/applications/academic_procedures/urls.py
index 0a7adea9f..a61a569b3 100644
--- a/FusionIIIT/applications/academic_procedures/urls.py
+++ b/FusionIIIT/applications/academic_procedures/urls.py
@@ -6,19 +6,23 @@
url(r'^main/', views.academic_procedures, name='procedures'),
url(r'^register/', views.register, name='register'),
url(r'^pre_registration/', views.pre_registration, name='pre_register'),
+ url(r'^auto_pre_registration/', views.auto_pre_registration, name='automatic_pre_register'),
+
url(r'^final_registration/', views.final_registration, name='final_register'),
url(r'^addCourse/', views.add_courses, name='addCourse'),
+ url(r'^add_one_course/' , views.add_one_course , name = 'add_one_course'),
url(r'^drop_course/', views.drop_course, name='drop_course'),
+ url(r'^replaceCourse/', views.replace_courses, name='replace_courses'),
+ url(r'^replace_one_course/', views.replace_one_course, name='replace_one_course'),
url(r'^branch-change/', views.approve_branch_change, name='branch_change'),
url(r'^brach-change-request/', views.branch_change_request,
name='branch_change_request'),
+ url(r'^acad_person/verifyCourse/drop/$',views.dropcourseadmin, name='dropcourseadmin'),
url(r'^acad_person/verifyCourse/', views.verify_course, name='verifyCourse'),
url(r'^acad_person/addCourse/', views.acad_add_course, name="acad_add_course"),
url(r'^acad_person/student_list$', views.student_list, name='studentlist'),
url(r'^acad_person/course_list$', views.course_list, name='courseList'),
url(r'^acad_person/$', views.acad_person, name='acad_person'),
- url(r'^acad_person/verifyCourse/drop/$',
- views.dropcourseadmin, name='dropcourseadmin'),
url(r'^branch-validate', views.approve_branch_change, name='branch_validate'),
url(r'^acad_person/branch_change/$',
views.acad_branch_change, name='acad_branch_change'),
@@ -27,6 +31,7 @@
url(r'^account/$', views.account),
url(r'^addThesis/$', views.add_thesis, name='add_thesis'),
url(r'^process_verification_request/$', views.process_verification_request),
+ url(r'^auto_process_verification_request/$', views.auto_process_verification_request),
url(r'^teaching_credit/$', views.teaching_credit_register),
url(r'^course_marks_data/$', views.course_marks_data), # --
url(r'^submit_marks/$', views.submit_marks), # --
@@ -65,6 +70,7 @@
url(r'^acad_person/remove_course_from_slot/' , views.remove_course_from_slot , name = 'remove_course_from_slot'),
url(r'^acad_person/add_course_to_slot/' , views.add_course_to_slot , name = 'add_course_to_slot'),
-
+ url(r'^acad_person/replaceSwayam/', views.replaceSwayam, name='replaceSwayam'),
+ url(r'^acad_person/swayam_replace/', views.swayam_replace, name='swayam_replace'),
]
diff --git a/FusionIIIT/applications/academic_procedures/views.py b/FusionIIIT/applications/academic_procedures/views.py
index 34587f02e..dc53e35f1 100644
--- a/FusionIIIT/applications/academic_procedures/views.py
+++ b/FusionIIIT/applications/academic_procedures/views.py
@@ -42,6 +42,11 @@
from .api import serializers
from django.core.serializers import serialize
+
+"""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 """
+
+
demo_date = timezone.now()
# demo_date = demo_date - datetime.timedelta(days = 180)
# demo_date = demo_date + datetime.timedelta(days = 180)
@@ -54,12 +59,7 @@
available_ece_seats = 100
available_me_seats = 100
-# assistantship_status = Assistantship_status.objects.all()
-# for obj in assistantship_status:
-# student_status = obj.student_status
-# hod_status = obj.hod_status
-# account_status = obj.account_status
@login_required(login_url='/accounts/login')
@@ -160,39 +160,14 @@ def academic_procedures_faculty(request):
phdprogress_request_list = PhDProgressExamination.objects.all().filter(Overall_grade = '')
courses_list = list(CourseInstructor.objects.select_related('course_id', 'batch_id', 'batch_id__discipline').filter(instructor_id__id=fac_id.id).only('course_id__code', 'course_id__name', 'batch_id'))
- user = request.user
- curriculum_ids = Curriculum_Instructor.objects.filter(instructor_id= user_details.pk).values_list('curriculum_id', flat=True)
- # Fetch course info for each curriculum ID
- course_infos = list(Curriculum.objects.filter(curriculum_id__in=curriculum_ids).values_list('course_code', 'course_type', 'programme', 'branch', 'sem', 'batch', 'course_id_id'))
+ assigned_courses = CourseInstructor.objects.select_related('course_id', 'batch_id', 'batch_id__discipline').filter(
+ instructor_id__id=fac_id.id, # Filter by faculty ID
+ batch_id__running_batch=True, # Filter by currently running batches
+ course_id__working_course=True # Filter by currently active courses
+ ).only('course_id__code', 'course_id__name', 'batch_id')
+ assigned_courses = list(assigned_courses)
- # Fetch course names using course IDs from course_infos
- course_ids = [info[6] for info in course_infos]
- # print(course_ids)
- course_names = Course.objects.filter(id__in=course_ids).values_list('course_name', flat=True)
-
- # Convert course_names queryset to a list
- course_name_values = list(course_names)
-
- # Update course_infos with course names
- for index, info in enumerate(course_infos):
- if(len(course_name_values) > index):
- course_infos[index] = (course_name_values[index],) + info[:7]
-
- # Fetch REAL COURSE ID using course CODE from course_infos
- # real_course_codes = [info[1] for info in course_infos]
- # print(real_course_codes)
- # real_course_ids = Courses.objects.filter(code__in=real_course_codes).values_list('id', flat=True)
-
- # Convert real_course_ids queryset to a list
- # real_course_ids_values = list(real_course_ids)
- # print(len(real_course_ids))
- # print(real_course_ids)
-
- # Update course_infos with real course IDs
- # for index, info in enumerate(course_infos):
- # if(len(real_course_ids_values) > index):
- # course_infos[index] = info[:7] + (real_course_ids_values[index],)
- # print('-------------------------------------------------------------------------------------' , course_infos)
+ # print('------------------------------------------------------------------------------------------------------------------' , list(assigned_courses))
r = range(4)
return render(
request,
@@ -216,9 +191,7 @@ def academic_procedures_faculty(request):
'mtechseminar_request_list' : mtechseminar_request_list,
'phdprogress_request_list' : phdprogress_request_list,
'r' : r,
- 'curriculum_ids' : curriculum_ids,
- 'course_infos' : course_infos,
- 'course_name_values' : course_name_values,
+ 'assigned_courses' : assigned_courses,
})
else:
HttpResponse("user not found")
@@ -384,12 +357,18 @@ def academic_procedures_student(request):
details = {
'current_user': current_user,
'year': acad_year,
- 'user_sem': user_sem,
+ 'user_sem': user_sem - 1,
'user_branch' : str(user_branch),
'cpi' : cpi,
}
cur_cpi=details['cpi']
+ swayam_courses_count = 0
+ next_sem_student = user_sem + 1
+ if(next_sem_student > 2):
+ swayam_courses_count = 2
+ if(next_sem_student == 6 or next_sem_student == 7 or next_sem_student == 8):
+ swayam_courses_count = 3
try:
pre_registered_courses = InitialRegistration.objects.all().filter(student_id = user_details.id,semester_id = next_sem_id)
@@ -413,12 +392,13 @@ def academic_procedures_student(request):
final_registered_course_show.append({"course_code":final_registered_course.course_id.code,"course_name":final_registered_course.course_id.name,"course_credit":final_registered_course.course_id.credit})
add_courses_options = get_add_course_options(current_sem_branch_course, currently_registered_course, batch.year)
drop_courses_options = get_drop_course_options(currently_registered_course)
-
+ replace_courses_options = get_replace_course_options(currently_registered_course, batch.year)
except Exception as e:
final_registered_courses = None
final_registered_course_show = None
- #drop_courses_options = None
+ # drop_courses_options = None
add_courses_options = None
+ replace_courses_options = None
fee_payment_mode_list = dict(Constants.PaymentMode)
@@ -549,6 +529,7 @@ def academic_procedures_student(request):
# 'add_course': add_course,
'add_courses_options': add_courses_options,
'drop_courses_options' : drop_courses_options,
+ 'replace_courses_options' : replace_courses_options,
# 'pre_register': pre_register,
'pre_registration_timestamp': pre_registration_timestamp,
'prd': pre_registration_date_flag,
@@ -557,6 +538,7 @@ def academic_procedures_student(request):
'adc_date_flag': add_or_drop_course_date_flag,
'pre_registration_flag' : pre_registration_flag,
'final_registration_flag': final_registration_flag,
+ 'swayam_courses_count':swayam_courses_count,
# 'final_r': final_register_1,
'teaching_credit_registration_course' : teaching_credit_registration_course,
@@ -898,12 +880,16 @@ def dropcourseadmin(request):
'''
data = request.GET.get('id')
data = data.split(" - ")
+ student_id = data[0]
course_code = data[1]
+ course = Courses.objects.get(code=course_code , version = 1.0)
# need to add batch and programme
- curriculum_object = Curriculum.objects.all().filter(course_code = course_code)
+ # curriculum_object = Curriculum.objects.all().filter(course_code = course_code)
try:
- Register.objects.filter(curr_id = curriculum_object.first(),student_id=int(data[0])).delete()
- except:
+ # Register.objects.filter(curr_id = curriculum_object.first(),student_id=int(data[0])).delete()
+ course_registration.objects.filter(student_id = student_id , course_id = course.id).delete()
+ except Exception as e:
+ print(str(e))
pass
# print("hello ")
response_data = {}
@@ -978,9 +964,12 @@ def verify_course(request):
'firstname': firstname, 'lastname': lastname}
obj2 = Student.objects.all().select_related(
'id', 'id__user', 'id__department').filter(id=roll_no).first()
- obj = Register.objects.all().select_related('curr_id', 'student_id', 'curr_id__course_id',
- 'student_id__id', 'student_id__id__user', 'student_id__id__department').filter(student_id=obj2)
- curr_sem_id = obj2.curr_semester_no
+ # obj = Register.objects.all().select_related('curr_id', 'student_id', 'curr_id__course_id',
+ # 'student_id__id', 'student_id__id__user', 'student_id__id__department').filter(student_id=obj2)
+ batch = obj2.batch_id
+ curr_id = batch.curriculum
+ curr_sem_id = Semester.objects.get(curriculum = curr_id, semester_no = obj2.curr_semester_no)
+ # curr_sem_id = obj2.curr_semester_no
details = []
current_sem_courses = get_currently_registered_course(
@@ -989,7 +978,10 @@ def verify_course(request):
idd = obj2
for z in current_sem_courses:
z = z[1]
- course_code, course_name = str(z).split(" - ")
+ print(z)
+ course_code = z.code
+ course_name = z.name
+ # course_code, course_name = str(z).split(" - ")
k = {}
# reg_ig has course registration id appended with the the roll number
# so that when we have removed the registration we can be redirected to this view
@@ -1001,7 +993,7 @@ def verify_course(request):
for p in courseobj2:
k['course_id'] = course_code
k['course_name'] = course_name
- k['sem'] = curr_sem_id
+ k['sem'] = curr_sem_id.semester_no
k['credits'] = p.credit
details.append(k)
@@ -1017,6 +1009,9 @@ def verify_course(request):
date = {'year': yearr, 'semflag': semflag}
course_list = Courses.objects.all()
semester_list = Semester.objects.all()
+ semester_no_list=[]
+ for i in semester_list:
+ semester_no_list.append(int(i.semester_no))
html = render_to_string('academic_procedures/studentCourses.html',
{'details': details,
'dict2': dict2,
@@ -1414,7 +1409,77 @@ def pre_registration(request):
else:
return HttpResponseRedirect('/academic-procedures/main')
+@login_required(login_url='/accounts/login')
+@transaction.atomic
+def auto_pre_registration(request):
+ if request.method == 'POST':
+ try:
+ current_user = get_object_or_404(User, username=request.POST.get('user'))
+ current_user = ExtraInfo.objects.all().select_related('user','department').filter(user=current_user).first()
+ current_user = Student.objects.all().filter(id=current_user.id).first()
+ sem_id = Semester.objects.get(id = request.POST.get('semester'))
+
+ course_slots=request.POST.getlist("course_slot")
+ try:
+ student_registeration_check=get_student_registrtion_check(current_user,sem_id)
+ if(student_registeration_check and student_registeration_check.pre_registration_flag==True):
+ messages.error(request,"You have already registered for next semester")
+ return HttpResponseRedirect('/academic-procedures/main')
+ except Exception as e:
+ print(e)
+
+ reg_curr = []
+ final_reg_curr = []
+ existing_entries = set()
+ for course_slot in course_slots :
+ course_priorities = request.POST.getlist("course_priority-"+course_slot)
+ if(course_priorities[0] == 'NULL'):
+ continue
+ course_slot_id_for_model = CourseSlot.objects.get(id = int(course_slot))
+ print("=----> course_priorities ----- ",course_priorities)
+ print("------------>course slot id ",course_slot_id_for_model)
+ for course_priority in course_priorities:
+ if(course_priority == 'NULL'):
+ continue
+ priority_of_current_course,course_id = map(int,course_priority.split("-"))
+
+ course_id_for_model = Courses.objects.get(id = course_id)
+ current_combination = (course_slot_id_for_model.id, course_id_for_model.id)
+ if current_combination not in existing_entries:
+ p = InitialRegistration(
+ course_id = course_id_for_model,
+ semester_id = sem_id,
+ student_id = current_user,
+ course_slot_id = course_slot_id_for_model,
+ priority = priority_of_current_course
+ )
+ f =FinalRegistration(student_id=current_user ,course_slot_id=course_slot_id_for_model , course_id=course_id_for_model ,semester_id=sem_id)
+ final_reg_curr.append(f)
+ reg_curr.append(p)
+ existing_entries.add(current_combination)
+ try:
+ InitialRegistration.objects.bulk_create(reg_curr)
+ FinalRegistration.objects.bulk_create(final_reg_curr)
+ registration_check = StudentRegistrationChecks(
+ student_id = current_user,
+ pre_registration_flag = True,
+ final_registration_flag = False,
+ semester_id = sem_id
+ )
+ registration_check.save()
+ messages.info(request, 'Successfully Registered.')
+ messages.success(request, "Successfully Registered.")
+ return HttpResponseRedirect('/academic-procedures/stu')
+ except Exception as e:
+ messages.error(request, "Error in Registration.")
+ return HttpResponseRedirect('/academic-procedures/stu')
+ except Exception as e:
+ messages.error(request, "Error in Registration.")
+ return HttpResponseRedirect('/academic-procedures/main')
+ else:
+ return HttpResponseRedirect('/academic-procedures/main')
+
def get_student_registrtion_check(obj, sem):
return StudentRegistrationChecks.objects.all().filter(student_id = obj, semester_id = sem).first()
@@ -1680,6 +1745,52 @@ def drop_course(request):
else:
return HttpResponseRedirect('/academic-procedures/main')
+def replace_courses(request):
+ """
+ This function is used to replace elective courses which have been registered
+ @param:
+ request - contains metadata about the requested page
+ @variables:
+ current_user - contains current logged in user
+ sem_id - contains current semester id
+ count - no of courses to be replaced
+ course_id - contains course id for a particular course
+ course_slot_id - contains course slot id for a particular course
+ choice - contains choice of a particular course
+ slot - contains slot of a particular course
+ """
+
+ if request.method == 'POST' :
+ try:
+ current_user = get_object_or_404(User, username=request.POST.get('user'))
+ current_user = ExtraInfo.objects.all().filter(user=current_user).first()
+ current_user = Student.objects.all().filter(id=current_user.id).first()
+
+ # sem_id = Semester.objects.get(id = request.POST.get('semester'))
+ count = request.POST.get('ct')
+ count = int(count)
+
+ for i in range(1, count+1):
+ choice = "choice["+str(i)+"]"
+ slot = "slot["+str(i)+"]"
+ try :
+
+ course_id = Courses.objects.get(id = request.POST.get(choice))
+ courseslot_id = CourseSlot.objects.get(id = request.POST.get(slot))
+
+ registered_course = course_registration.objects.filter(student_id=current_user, course_slot_id = courseslot_id).first()
+
+ if registered_course:
+ registered_course.course_id = course_id
+ registered_course.save()
+ except Exception as e:
+ continue
+ return HttpResponseRedirect('/academic-procedures/main')
+ except Exception as e:
+ return HttpResponseRedirect('/academic-procedures/main')
+ else :
+ return HttpResponseRedirect('/academic-procedures/main')
+
@@ -1779,7 +1890,7 @@ def get_final_registration_choices(branch_courses,batch):
max_limit = courseslot.max_registration_limit
lis = []
for course in courseslot.courses.all():
- if FinalRegistration .objects.filter(student_id__batch_id__year = batch, course_id = course).count() < max_limit:
+ if FinalRegistration.objects.filter(student_id__batch_id__year = batch, course_id = course).count() < max_limit:
lis.append(course)
else:
unavailable_courses.append(course)
@@ -1810,7 +1921,24 @@ def get_drop_course_options(current_register):
courses.append(item[1])
return courses
+def get_replace_course_options( current_register, batch):
+ replace_options = []
+ for registered_course in current_register:
+ courseslot_id = registered_course[0]
+ course_id = registered_course[1]
+
+ courseslot = courseslot_id
+ coursename = course_id.name
+ lis = []
+
+ if 'Elective' in courseslot.type:
+ for course in courseslot.courses.all():
+ if course != course_id:
+ lis.append(course)
+ replace_options.append((courseslot, coursename, lis))
+
+ return replace_options
@@ -2280,12 +2408,13 @@ def student_list(request):
batch_id = Batch.objects.get(id = batch)
student_obj = FeePayments.objects.all().select_related('student_id').filter(student_id__batch_id = batch_id)
if (student_obj):
- reg_table = student_obj.prefetch_related('student_id__studentregistrationchecks').filter(semester_id = student_obj[0].semester_id, student_id__studentregistrationchecks__final_registration_flag = True , student_id__finalregistration__verified=False).select_related(
+ reg_table = student_obj.prefetch_related('student_id__studentregistrationchecks').filter(semester_id = student_obj[0].semester_id, student_id__studentregistrationchecks__final_registration_flag = True , student_id__finalregistration__verified=False , student_id__finalregistration__semester_id= student_obj[0].semester_id ).select_related(
'student_id','student_id__id','student_id__id__user','student_id__id__department').values(
'student_id__id','student_id__id__user__first_name','student_id__id__user__last_name','student_id__batch','student_id__id__department__name',
'student_id__programme','student_id__curr_semester_no','student_id__id__sex','student_id__id__phone_no','student_id__category',
'student_id__specialization','mode','transaction_id','deposit_date','fee_paid','utr_number','reason','fee_receipt','actual_fee',
'student_id__id__user__username').order_by('student_id__id__user').distinct()
+ # print('------------------------------------------------------------------------------------------------------------------------------------------',reg_table)
else :
reg_table = []
@@ -2383,6 +2512,12 @@ def process_verification_request(request):
return verify_registration(request)
return JsonResponse({'status': 'Failed'}, status=400)
+
+def auto_process_verification_request(request):
+ if request.is_ajax():
+ return auto_verify_registration(request)
+ return JsonResponse({'status': 'Failed'}, status=400)
+
@transaction.atomic
def verify_registration(request):
@@ -2402,7 +2537,7 @@ def verify_registration(request):
final_register_list = FinalRegistration.objects.all().filter(student_id = student, verified = False, semester_id = sem_id)
-
+
with transaction.atomic():
ver_reg = []
for obj in final_register_list:
@@ -2415,6 +2550,7 @@ def verify_registration(request):
ver_reg.append(p)
o = FinalRegistration.objects.filter(id= obj.id).update(verified = True)
course_registration.objects.bulk_create(ver_reg)
+ # StudentRegistrationChecks.objects.filter(student_id = student_id, semester_id = sem_id).update(final_registration_flag = True)
academics_module_notif(request.user, student.id.user, 'registration_approved')
Student.objects.filter(id = student_id).update(curr_semester_no = sem_no)
return JsonResponse({'status': 'success', 'message': 'Successfully Accepted'})
@@ -2438,8 +2574,53 @@ def verify_registration(request):
academics_module_notif(academicadmin, student_id.id.user, 'Registration Declined - '+reject_reason)
return JsonResponse({'status': 'success', 'message': 'Successfully Rejected'})
-
-
+@transaction.atomic
+def auto_verify_registration(request):
+ if request.POST.get('status_req') == "accept" :
+ student_id = request.POST.get('student_id')
+ student = Student.objects.get(id = student_id)
+ batch = student.batch_id
+ curr_id = batch.curriculum
+
+ if(student.curr_semester_no+1 >= 9):
+ # print('----------------------------------------------------------------' , student.curr_semester_no)
+ sem_no = 8
+ else:
+ # print('----------------------------------------------------------------' , student.curr_semester_no)
+ sem_no = student.curr_semester_no+1
+ sem_id = Semester.objects.get(curriculum = curr_id, semester_no = sem_no)
+ # print('----------------------------------------------------------------' , student.curr_semester_no)
+
+ final_register_list = FinalRegistration.objects.all().filter(student_id = student, verified = False, semester_id = sem_id)
+
+ # final_register_list = FinalRegistration.objects.all().filter(student_id = student, verified = False)
+
+ with transaction.atomic():
+ for obj in final_register_list:
+ o = FinalRegistration.objects.filter(id= obj.id).update(verified = True)
+ academics_module_notif(request.user, student.id.user, 'registration_approved')
+
+ Student.objects.filter(id = student_id).update(curr_semester_no = sem_no)
+ return JsonResponse({'status': 'success', 'message': 'Successfully Accepted'})
+
+ elif request.POST.get('status_req') == "reject" :
+ reject_reason = request.POST.get('reason')
+ student_id = request.POST.get('student_id')
+ student_id = Student.objects.get(id = student_id)
+ batch = student_id.batch_id
+ curr_id = batch.curriculum
+ if(student_id.curr_semester_no+1 >= 9):
+ sem_no = 8
+ else:
+ sem_no = student_id.curr_semester_no+1
+ sem_id = Semester.objects.get(curriculum = curr_id, semester_no = sem_no)
+ with transaction.atomic():
+ academicadmin = get_object_or_404(User, username = "acadadmin")
+ FinalRegistration.objects.filter(student_id = student_id, verified = False, semester_id = sem_id).delete()
+ StudentRegistrationChecks.objects.filter(student_id = student_id, semester_id = sem_id).update(final_registration_flag = False)
+ FeePayments.objects.filter(student_id = student_id, semester_id = sem_id).delete()
+ academics_module_notif(academicadmin, student_id.id.user, 'Registration Declined - '+reject_reason)
+ return JsonResponse({'status': 'success', 'message': 'Successfully Rejected'})
def get_registration_courses(courses):
x = [[]]
@@ -2504,8 +2685,8 @@ def course_marks_data(request):
try:
course_id = request.POST.get('course_id')
course = Courses.objects.select_related().get(id = course_id)
- print(course)
- print(course_id)
+ # print(course)
+ # print(course_id)
student_list = course_registration.objects.filter(course_id__id=course_id).select_related(
'student_id__id__user','student_id__id__department').only('student_id__batch',
'student_id__id__user__first_name', 'student_id__id__user__last_name',
@@ -3565,7 +3746,6 @@ def get_next_sem_courses(request):
if next_sem_id:
next_sem_registration_courses = get_detailed_sem_courses(next_sem_id )
- # next_sem_registration_courses = serializers.CourseSlotSerializer(next_sem_registration_courses).data
# print(next_sem_registration_courses)
return JsonResponse(next_sem_registration_courses, safe=False)
return JsonResponse({'error': 'Invalid request'})
@@ -3608,3 +3788,275 @@ def remove_course_from_slot(request):
return JsonResponse({'error': 'Course does not exist.'}, status=400)
return JsonResponse({'error': 'Invalid request method.'}, status=405)
+
+
+def add_one_course(request):
+ if request.method == 'POST':
+ try:
+ # print(request.POST)
+ current_user = get_object_or_404(User, username=request.POST.get('user'))
+ current_user = ExtraInfo.objects.all().filter(user=current_user).first()
+ current_user = Student.objects.all().filter(id=current_user.id).first()
+
+ sem_id = Semester.objects.get(id=request.POST.get('semester'))
+ choice = request.POST.get('choice')
+ slot = request.POST.get('slot')
+
+ try:
+ course_id = Courses.objects.get(id=choice)
+ courseslot_id = CourseSlot.objects.get(id=slot)
+ print(courseslot_id)
+ print(courseslot_id.type)
+ if course_registration.objects.filter(course_slot_id_id=courseslot_id, student_id=current_user).count() == 1 and courseslot_id.type != "Swayam":
+ already_registered_course_id = course_registration.objects.filter(course_slot_id_id=courseslot_id, student_id=current_user)[0].course_id
+ # print(already_registered_course_id)
+ msg = 'Already Registered in the course : ' +already_registered_course_id.code + '-'+ already_registered_course_id.name
+ return JsonResponse({'message' : msg})
+ if((course_registration.objects.filter(course_id=course_id, student_id=current_user).count() >= 1)):
+ return JsonResponse({'message': 'Already registered in this course!'}, status=200)
+ # Check if maximum course registration limit has not been reached
+ if course_registration.objects.filter(student_id__batch_id__year=current_user.batch_id.year, course_id=course_id).count() < courseslot_id.max_registration_limit and \
+ (course_registration.objects.filter(course_id=course_id, student_id=current_user).count() == 0):
+ p = course_registration(
+ course_id=course_id,
+ student_id=current_user,
+ course_slot_id=courseslot_id,
+ semester_id=sem_id
+ )
+ p.save()
+ return JsonResponse({'message': 'Course added successfully'})
+ else:
+ return JsonResponse({'message': 'Course not added because seats are full!'}, status=200)
+ except Exception as e:
+ return JsonResponse({'message': 'Error adding course'}, status=500)
+ except Exception as e:
+ return JsonResponse({'message': 'Error adding course'}, status=500)
+ else:
+ return JsonResponse({'message': 'Invalid request method'}, status=405)
+
+def replace_one_course(request):
+ if request.method == 'POST' :
+ try:
+ current_user = get_object_or_404(User, username=request.POST.get('user'))
+ current_user = ExtraInfo.objects.all().filter(user=current_user).first()
+ current_user = Student.objects.all().filter(id=current_user.id).first()
+
+
+ course_id = Courses.objects.get(id = request.POST.get('choice'))
+ courseslot_id = CourseSlot.objects.get(id = request.POST.get('slot'))
+ if course_registration.objects.filter(student_id__batch_id__year=current_user.batch_id.year, course_id=course_id).count() < courseslot_id.max_registration_limit and \
+ (course_registration.objects.filter(course_id=course_id, student_id=current_user).count() == 0):
+ # print('---------------------------------------------------------------------------------' , course_registration.objects.filter(student_id__batch_id__year=current_user.batch_id.year, course_id=course_id).count() , courseslot_id.max_registration_limit )
+ registered_course = course_registration.objects.filter(student_id=current_user, course_slot_id = courseslot_id).first()
+
+ if registered_course:
+ registered_course.course_id = course_id
+ registered_course.save()
+ else:
+ return JsonResponse({'message': 'Cannot Replace to this course seats are full!'}, status=200)
+
+ return JsonResponse({'message': 'Course Replaced Successfully'}, status=200)
+ except Exception as e:
+ return JsonResponse({'message': 'Error Replacing course'}, status=500)
+ else :
+ return JsonResponse({'message': 'Invalid request method'}, status=405)
+
+def get_sem_swayam(sem_id, batch):
+ courses = []
+ course_slots = CourseSlot.objects.all().filter(type='Swayam')
+
+ for slot in course_slots:
+ courses.append(slot)
+
+ return courses
+
+def replaceSwayam(request):
+ if(request.POST):
+ # print(f"++++++++++++++++++++++++++++++++++++++++++++++++{request.POST}")
+
+ current_user = get_object_or_404(User, username=request.user.username)
+ user_details = ExtraInfo.objects.all().select_related(
+ 'user', 'department').filter(user=current_user).first()
+ desig_id = Designation.objects.all().filter(name='adminstrator').first()
+ temp = HoldsDesignation.objects.all().select_related().filter(
+ designation=desig_id).first()
+ acadadmin = temp.working
+ k = str(user_details).split()
+ final_user = k[2]
+
+ if (str(acadadmin) != str(final_user)):
+ return HttpResponseRedirect('/academic-procedures/')
+ roll_no = request.POST["rollNo"]
+ obj = ExtraInfo.objects.all().select_related(
+ 'user', 'department').filter(id=roll_no).first()
+ firstname = obj.user.first_name
+ lastname = obj.user.last_name
+ dict2 = {'roll_no': roll_no,
+ 'firstname': firstname, 'lastname': lastname}
+
+
+ details = []
+
+ obj2 = Student.objects.all().select_related(
+ 'id', 'id__user', 'id__department').filter(id=roll_no).first()
+ # obj = Register.objects.all().select_related('curr_id', 'student_id', 'curr_id__course_id',
+ # 'student_id__id', 'student_id__id__user', 'student_id__id__department').filter(student_id=obj2)
+ batch = obj2.batch_id
+ curr_id = batch.curriculum
+ curr_sem_id = Semester.objects.get(curriculum = curr_id, semester_no = obj2.curr_semester_no)
+
+ current_sem_courses = get_currently_registered_elective(
+ roll_no, curr_sem_id)
+ current_sem_swayam = get_sem_swayam(curr_sem_id,2025)
+
+ idd = obj2
+ for z in current_sem_courses:
+ eletive_id=z[2]
+ z = z[1]
+
+ course_code = z.code
+ course_name = z.name
+
+ k = {}
+ # reg_ig has course registration id appended with the the roll number
+ # so that when we have removed the registration we can be redirected to this view
+ k['reg_id'] = roll_no+" - "+course_code
+ k['rid'] = roll_no+" - "+course_code
+ # Name ID Confusion here , be carefull
+ courseobj2 = Courses.objects.all().filter(code=course_code)
+ # if(str(z.student_id) == str(idd)):
+ for p in courseobj2:
+ k['course_id'] = course_code
+ k['course_name'] = course_name
+ k['sem'] = curr_sem_id.semester_no
+ k['credits'] = p.credit
+ k['eletive_id'] = eletive_id
+ details.append(k)
+
+ year = demo_date.year
+ month = demo_date.month
+ yearr = str(year) + "-" + str(year+1)
+ semflag = 0
+ if(month >= 7):
+ semflag = 1
+ else:
+ semflag = 2
+ # TO DO Bdes
+ date = {'year': yearr, 'semflag': semflag}
+ course_list = Courses.objects.all()
+ semester_list = Semester.objects.all()
+ html = render_to_string('academic_procedures/studentSwayam.html',
+ {'details': details,
+ 'dict2': dict2,
+ 'course_list': course_list,
+ 'current_sem_swayam':current_sem_swayam,
+ 'roll_no':roll_no,
+ 'semester_list': semester_list,
+ # 'csrf_token' : csrf_token,
+ 'date': date}, request)
+
+ maindict = {'html': html}
+ obj = json.dumps(maindict)
+ return HttpResponse(obj, content_type='application/json')
+
+def get_currently_registered_elective(student_id, semester_id):
+ registrations = course_registration.objects.filter(student_id=student_id, semester_id=semester_id)
+ courses = []
+ for registration in registrations:
+ if registration.course_slot_id.type == "Optional Elective":
+ courses.append((registration.course_slot_id, registration.course_id, registration.id))
+ return courses
+
+
+
+def swayam_replace(request):
+ if request.method == 'POST':
+ csrf_token = request.POST.get('csrfmiddlewaretoken', None)
+
+ # print(f"---------------------------------{csrf_token}")
+ try:
+
+ # print(f"djfhajjfsjfhajfhjdsfsdfj{request.POST}")
+ csrf_token = request.POST.get('csrfmiddlewaretoken', None)
+
+ # print(f"---------------------------------{csrf_token}")
+ # Accessing individual values by key
+ user_value = request.POST['user']
+ course_id_value = request.POST['course_id']
+
+ # print(user_value) 20BCS074
+ # print(course_id_value) 8955
+
+ elective_to_delete = course_registration.objects.get(id=course_id_value)
+ sem = elective_to_delete.semester_id
+ # print(elective_to_delete)
+ # print(sem) cse ug curri v1
+
+
+ swayam_course_id_value = request.POST['swayam_course_id']
+ swayam_course_id_value_array = [int(id_str) for id_str in swayam_course_id_value.split(',')[:-1]]
+ # print(swayam_course_id_value_array)
+ # print(swayam_course_id_value)
+
+
+
+ swayam_course_slot_id_value = request.POST['swayam_course_slot_id']
+ swayam_course_slot_id_value_array = [int(slot_str) for slot_str in swayam_course_slot_id_value.split(',')[:-1]]
+ # print(swayam_course_slot_id_value_array)
+ # print(swayam_course_slot_id_value)
+
+
+ swayam_semester_id_value = request.POST['swayam_semester_id']
+ swayam_semester_id_value_array = [int(semester_str) for semester_str in swayam_semester_id_value.split(',')[:-1]]
+ # print(swayam_semester_id_value_array)
+ # print(swayam_semester_id_value)
+
+ # from your_app.models import Student
+ # Retrieve the Student object based on the student ID
+ # student_id = '20BCS074'
+ # student_model = Student.objects.get(id=user_value)
+ #print(student)
+ # course_id_model = Course.objects.get()
+ # Create the course_registration object with the Student object
+ # course_registration.objects.create(student_id=student, ...)
+
+
+
+
+ n = len(swayam_course_id_value_array)
+ # print(n)
+ # new_row_data = []
+ for i in range(n):
+ course_id_model = Courses.objects.get(id=swayam_course_id_value_array[i])
+ # print(course_id_model)
+ semester_id_model = Semester.objects.get(id=swayam_semester_id_value_array[i])
+ student_id_model = Student.objects.get(id=user_value)
+ course_slot_id_model = CourseSlot.objects.get(id=swayam_course_slot_id_value_array[i])
+ obj = course_registration(
+ course_id = course_id_model,
+ semester_id = semester_id_model,
+ student_id = student_id_model,
+ course_slot_id = course_slot_id_model,
+ working_year = 1
+ )
+ obj.save()
+
+ # for j in range(n):
+ # SwayamCourses.objects.filter(course_id = swayam_course_id_value_array[j], student_id=user_value).update(course_used = True)
+
+ elective_to_delete.delete()
+
+
+ messages.success(request, "Your Courses have been replaced.")
+ return HttpResponseRedirect('/academic-procedures/main')
+
+
+
+
+ except Exception as e:
+ error_message = str(e)
+ print("Error:", error_message)
+ messages.error(request, f"Error in Registration: {error_message}")
+ return HttpResponseRedirect('/academic-procedures/main')
+ else:
+ return HttpResponseRedirect('/academic-procedures/main')
\ No newline at end of file
diff --git a/FusionIIIT/applications/globals/urls.py b/FusionIIIT/applications/globals/urls.py
index f8d82ee71..2dea4e77d 100644
--- a/FusionIIIT/applications/globals/urls.py
+++ b/FusionIIIT/applications/globals/urls.py
@@ -23,5 +23,6 @@
# Endpoint to reset all passwords in DEV environment
url(r'^resetallpass/$', views.reset_all_pass, name='resetallpass'),
# API urls
- url(r'^api/', include('applications.globals.api.urls'))
+ url(r'^api/', include('applications.globals.api.urls')),
+ url(r'^update_global_variable/$', views.update_global_variable, name='update_global_var'),
]
diff --git a/FusionIIIT/applications/globals/views.py b/FusionIIIT/applications/globals/views.py
index a7f3886c9..5b023abb5 100644
--- a/FusionIIIT/applications/globals/views.py
+++ b/FusionIIIT/applications/globals/views.py
@@ -740,21 +740,26 @@ def dashboard(request):
}
# a=HoldsDesignation.objects.select_related('user','working','designation').filter(designation = user)
+ print(context)
+ print(type(user.extrainfo.user_type))
if(request.user.get_username() == 'director'):
return render(request, "dashboard/director_dashboard2.html", {})
elif( "dean_rspc" in designation):
return render(request, "dashboard/dashboard.html", context)
- elif user.extrainfo.user_type != 'student':
+ elif user.extrainfo.user_type != "student":
+ print ("inside")
designat = HoldsDesignation.objects.select_related().filter(user=user)
response = {'designat':designat}
context.update(response)
return render(request, "dashboard/dashboard.html", context)
else:
+ print ("inside2")
+
return render(request, "dashboard/dashboard.html", context)
@login_required(login_url=LOGIN_URL)
-def profile(request, username=None):
+def profile(request, username=None):
"""
Generic endpoint for views.
If it's a faculty, redirects to /eis/profile/*
@@ -768,16 +773,76 @@ def profile(request, username=None):
"""
user = get_object_or_404(User, Q(username=username)) if username else request.user
-
editable = request.user == user
+ print("editable",editable)
profile = get_object_or_404(ExtraInfo, Q(user=user))
+ print("profile",profile)
if(str(user.extrainfo.user_type)=='faculty'):
+ print("profile")
return HttpResponseRedirect('/eis/profile/' + (username if username else ''))
if(str(user.extrainfo.department)=='department: Academics'):
+ print("profile2")
return HttpResponseRedirect('/aims')
- current = HoldsDesignation.objects.select_related('user','working','designation').filter(Q(working=user, designation__name="student"))
+
+ array = [
+ "student",
+ "CC convenor",
+ "Mechatronic convenor",
+ "mess_committee",
+ "mess_convener",
+ "alumini",
+ "Electrical_AE",
+ "Electrical_JE",
+ "Civil_AE",
+ "Civil_JE",
+ "co-ordinator",
+ "co co-ordinator",
+ "Convenor",
+ "Convener",
+ "cc1convener",
+ "CC2 convener",
+ "mess_convener_mess2",
+ "mess_committee_mess2"
+]
+
+ # queryset = HoldsDesignation.objects.select_related('user','working','designation').filter(Q(working=user))
+
+ # for obj in queryset:
+ # designation_name = obj.designation.name
+ # print("designation_name",designation_name)
+
+ # design = False
+ # if designation_name in array:
+ # design = True
+ # print("design",design)
+ # print("designation_name",designation_name)
+ # if design:
+ # current = HoldsDesignation.objects.select_relapted('user','working','designation').filter(Q(working=user, designation__name=designation_name))
+ # for obj in current:
+ # obj.designation.name = obj.designation.name.replace(designation_name, 'student')
+
+ designation_name = ""
+ design = False
+
+ current = HoldsDesignation.objects.select_related('user', 'working', 'designation').filter(Q(working=user))
+
+ for obj in current:
+ designation_name = obj.designation.name
+ if designation_name in array:
+ design = True
+ break
+
+ if design:
+ current = HoldsDesignation.objects.filter(working=user, designation__name=designation_name)
+ for obj in current:
+ obj.designation.name = obj.designation.name.replace(designation_name, 'student')
+
+ print(user.extrainfo.user_type)
+ print("current",current)
if current:
+ print("profile3")
student = get_object_or_404(Student, Q(id=profile.id))
+ print("student",student)
if editable and request.method == 'POST':
if 'studentapprovesubmit' in request.POST:
status = PlacementStatus.objects.select_related('notify_id','unique_id__id__user','unique_id__id__department').filter(pk=request.POST['studentapprovesubmit']).update(invitation='ACCEPTED', timestamp=timezone.now())
@@ -979,6 +1044,7 @@ def profile(request, username=None):
return render(request, "globals/student_profile4.html", context)
if 'achievementsubmit' in request.POST or 'deleteach' in request.POST:
return render(request, "globals/student_profile5.html", context)
+ print("context",context)
return render(request, "globals/student_profile.html", context)
else:
return redirect("/")
@@ -1176,4 +1242,15 @@ def search(request):
if len(search_results) == 0:
search_results = []
context = {'sresults':search_results}
- return render(request, "globals/search.html", context)
+ return render(request, "globals/search.html", context),
+
+@login_required(login_url=LOGIN_URL)
+def update_global_variable(request):
+ if request.method == 'POST':
+ selected_option = request.POST.get('dropdown')
+ request.session['currentDesignationSelected'] = selected_option
+ print(selected_option)
+ print(request.session['currentDesignationSelected'])
+ return HttpResponseRedirect(request.META.get('HTTP_REFERER', '/'))
+ # Redirect to home if not a POST request or some issue occurs
+ return HttpResponseRedirect(reverse('home'))
diff --git a/FusionIIIT/applications/programme_curriculum/models.py b/FusionIIIT/applications/programme_curriculum/models.py
index 7f6a59bf6..968e6cbc4 100644
--- a/FusionIIIT/applications/programme_curriculum/models.py
+++ b/FusionIIIT/applications/programme_curriculum/models.py
@@ -7,6 +7,7 @@
from django.utils.translation import gettext_lazy as _
from django.core.exceptions import ValidationError
from applications.globals.models import ExtraInfo
+from django.core.validators import MinValueValidator, MaxValueValidator, DecimalValidator
# Create your models here.
@@ -26,7 +27,8 @@
('Design', 'Design'),
('Manufacturing', 'Manufacturing'),
('Management Science', 'Management Science'),
- ('Optional Elective', 'Optional Elective'),
+ ('Open Elective', 'Open Elective'),
+ ('Swayam','Swayam'),
('Project', 'Project'),
('Optional', 'Optional'),
('Others', 'Others')
@@ -59,7 +61,7 @@ class Programme(models.Model):
name = models.CharField(max_length=70, null=False, unique=True, blank=False)
programme_begin_year = models.PositiveIntegerField(default=datetime.date.today().year, null=False)
- def __str__(self):
+ def _str_(self):
return str(self.category + " - "+ self.name)
@property
@@ -90,7 +92,7 @@ class Discipline(models.Model):
acronym = models.CharField(max_length=10, null=False, default="", blank=False)
programmes = models.ManyToManyField(Programme, blank=True)
- def __str__(self):
+ def _str_(self):
return str(self.name) + " " + str(self.acronym)
@property
@@ -117,7 +119,11 @@ class Curriculum(models.Model):
'''
programme = models.ForeignKey(Programme, on_delete=models.CASCADE, null=False)
name = models.CharField(max_length=100, null=False, blank=False)
- version = models.PositiveIntegerField(default=1, null=False)
+ version = models.DecimalField(
+ max_digits=2,
+ decimal_places=1,
+ default=1.0,
+ validators=[MinValueValidator(1.0), DecimalValidator(max_digits=2, decimal_places=1)])
working_curriculum = models.BooleanField(default=True, null=False)
no_of_semester = models.PositiveIntegerField(default=1, null=False)
min_credit = models.PositiveIntegerField(default=0, null=False)
@@ -125,7 +131,7 @@ class Curriculum(models.Model):
class Meta:
unique_together = ('name', 'version',)
- def __str__(self):
+ def _str_(self):
return str(self.name + " v" + str(self.version))
@property
@@ -166,8 +172,8 @@ class Semester(models.Model):
class Meta:
unique_together = ('curriculum', 'semester_no',)
- def __str__(self):
- return str(Curriculum.__str__(self.curriculum) + ", sem-" + str(self.semester_no))
+ def _str_(self):
+ return str(Curriculum._str_(self.curriculum) + ", sem-" + str(self.semester_no))
@property
def courseslots(self):
@@ -207,8 +213,13 @@ class Course(models.Model):
'''
- code = models.CharField(max_length=10, null=False, unique=True, blank=False)
- name = models.CharField(max_length=100, null=False, unique=True, blank=False)
+ code = models.CharField(max_length=10, null=False, blank=False)
+ name = models.CharField(max_length=100, null=False, blank=False)
+ version = models.DecimalField(
+ max_digits=2,
+ decimal_places=1,
+ default=1.0,
+ validators=[MinValueValidator(1.0), DecimalValidator(max_digits=2, decimal_places=1)])
credit = models.PositiveIntegerField(default=0, null=False, blank=False)
lecture_hours = PositiveIntegerField(null=True, )
tutorial_hours = PositiveIntegerField(null=True)
@@ -228,12 +239,14 @@ class Course(models.Model):
ref_books = models.TextField()
working_course = models.BooleanField(default=True)
disciplines = models.ManyToManyField(Discipline, blank=True)
+ latest_version = models.BooleanField(default=True)
class Meta:
- unique_together = ('code', 'name',)
+ unique_together = ('code','version')
- def __str__(self):
- return str(self.code + " - " +self.name)
+ def _str_(self):
+ return str(self.code + " - " +self.name+"- v"+str(self.version))
+
@property
def courseslots(self):
@@ -268,7 +281,7 @@ class Batch(models.Model):
class Meta:
unique_together = ('name', 'discipline', 'year',)
- def __str__(self):
+ def _str_(self):
return str(self.name) + " " + str(self.discipline.acronym) + " " + str(self.year)
@@ -277,11 +290,6 @@ class CourseSlot(models.Model):
Current Purpose : To store the details regarding a course slot
Course slot : is defined as per the curriculum for a programme to have specific type of courses
for a given semester
-
-
-
-
-
ATTRIBUTES :
semester(programme_curriculum.Semester) - [not nullable] to denote link to the semester details for which the courseslot is made
@@ -304,8 +312,8 @@ class CourseSlot(models.Model):
max_registration_limit = models.PositiveIntegerField(default = 1000)
- def __str__(self):
- return str(Semester.__str__(self.semester) + ", " + self.name)
+ def _str_(self):
+ return str(Semester._str_(self.semester) + ", " + self.name)
class Meta:
unique_together = ('semester', 'name', 'type')
@@ -324,6 +332,5 @@ class Meta:
unique_together = ('course_id', 'instructor_id', 'batch_id')
- def __self__(self):
- return '{} - {}'.format(self.course_id, self.instructor_id)
-
\ No newline at end of file
+ def _self_(self):
+ return '{} - {}'.format(self.course_id, self.instructor_id)
\ No newline at end of file
diff --git a/FusionIIIT/templates/academic_procedures/academic.html b/FusionIIIT/templates/academic_procedures/academic.html
old mode 100755
new mode 100644
index 5f5ee86ad..90b518b0b
--- a/FusionIIIT/templates/academic_procedures/academic.html
+++ b/FusionIIIT/templates/academic_procedures/academic.html
@@ -22,6 +22,39 @@
}
+
+
{% endblock css %}
@@ -30,13 +63,12 @@
{% include 'dashboard/navbar.html' %}
{% endblock %}
-
+
- {% comment %}The left-margin segment!{% endcomment %}
-
+
{% comment %}The left-rail segment starts here!{% endcomment %}
-
+
{% comment %}The user image card starts here!{% endcomment %}
{% block usercard %}
{% include 'globals/usercard.html' %}
@@ -46,8 +78,8 @@
{% comment %}The Tab-Menu starts here!{% endcomment %}
-
@@ -175,6 +207,9 @@
Backlogs
+
+ Replace
+
diff --git a/FusionIIIT/templates/academic_procedures/academicfac.html b/FusionIIIT/templates/academic_procedures/academicfac.html
index 3ed8d61d2..db08757d7 100644
--- a/FusionIIIT/templates/academic_procedures/academicfac.html
+++ b/FusionIIIT/templates/academic_procedures/academicfac.html
@@ -26,7 +26,7 @@
{% if fac_flag %}
{% if request.user.extrainfo.user_type == 'fx' or request.user.extrainfo.user_type == 'faculty' %}
-
+
Assigned Course
@@ -67,11 +67,11 @@
Kartik
{% endcomment %}
-
+
@@ -80,31 +80,35 @@
Course Code |
- Course Type |
+ Course Version |
Programme |
Branch |
- Semester |
+ Year |
+
Download Roll List |
-
+
- {% for course_info in course_infos %}
+ {% for course in assigned_courses %}
- {% for course_in in course_info|slice:":6" %}
- {{course_in }}
- |
- {%endfor%}
+ {{course.course_id.name }} |
+ {{course.course_id.code }} |
+ {{course.course_id.version }} |
+ {{course.batch_id.name }} |
+ {{course.batch_id.discipline.name }} |
+ {{course.batch_id.year }} |
+
|
@@ -116,7 +120,7 @@
-
+
@@ -131,7 +135,7 @@
{{obj.course_id.code}} |
{{obj.course_id.name}} |
- {{ obj.batch_id }} |
+ {{ obj.batch_id.name}} {{obj.batch_id.year}}-{{obj.batch_id.discipline.name}} |
RollNo | CourseSlot Name | CourseCode | CourseName
-
diff --git a/FusionIIIT/templates/academic_procedures/auto_finalregister.html b/FusionIIIT/templates/academic_procedures/auto_finalregister.html
new file mode 100644
index 000000000..95788c24d
--- /dev/null
+++ b/FusionIIIT/templates/academic_procedures/auto_finalregister.html
@@ -0,0 +1,251 @@
+{% load static %}
+{% block finalregister %}
+
+
+
+
+ Final Registration
+
+
+ {% if curr_sem.semester_no != 8 %}
+ {% if frd %}
+ {% if final_registration_flag == True %}
+
+ You have already registered for this semester!!!
+
+
+
+ {% else %}
+
+
+
+ {% comment %} {% endcomment %}
+ {% endif %}
+ {% else %}
+
+ Final Registration Date is yet to come
+
+ {% endif %}
+ {% else %}
+
+ You are not Eligible for Registration !!
+
+ {% endif %}
+
+{% endblock %}
+
+
+
+
+
+
+
+
\ No newline at end of file
diff --git a/FusionIIIT/templates/academic_procedures/auto_pre_registration.html b/FusionIIIT/templates/academic_procedures/auto_pre_registration.html
new file mode 100644
index 000000000..b9129ca23
--- /dev/null
+++ b/FusionIIIT/templates/academic_procedures/auto_pre_registration.html
@@ -0,0 +1,437 @@
+
+
+
+
+{% load static %}
+{% block resiterstudent %}
+
+
+ Pre-Registration for Next Semester Courses
+
+ {% if curr_sem.semester_no != 8 %}
+ {% if prd %}
+ {% if pre_registration_flag %}
+
+ You have already registered at
+ {% if pre_registration_timestamp is not None %}
+ {{pre_registration_timestamp}}
+ {% endif %}
+ !!!
+
+ View Courses
+ Hide courses
+
+
+
+
+
+
+ # |
+ Course Slot |
+ Course Code |
+ Course Name |
+ Credits |
+
+
+
+ {% for course_slot,courses in pre_registered_course_show.items %}
+
+ {{forloop.counter}}. |
+ {{course_slot}} |
+
+
+ {% for course in courses %}
+ {{ course.course_code }}
+
+ {% endfor %}
+ |
+
+ {% for course in courses %}
+ {{course.course_name}}
+
+ {% endfor %}
+ |
+
+ {% for course in courses %}
+ {{course.course_credit}}
+
+ {% endfor %}
+ |
+
+
+ {% endfor %}
+
+
+
+
+
+ {% else %}
+
+
+
+
+
+ You need minimum {{curr_sem.curriculum.min_credit}} credits for semester {{next_sem.semester_no}}
+
+
+ {% endif %}
+ {% else %}
+ {% if prd_start_date%}
+
+ Pre Registration will start on {{prd_start_date}}.
+
+ {% else %}
+
+ Pre Registration date hasn't come yet
+
+ {% endif %}
+ {% endif %}
+ {% else %}
+
+ You are not Eligible for Registration !!
+
+ {% endif %}
+
+
+
+
+
+{% endblock %}
+
+
+
+
diff --git a/FusionIIIT/templates/academic_procedures/replace.html b/FusionIIIT/templates/academic_procedures/replace.html
new file mode 100644
index 000000000..c130aac92
--- /dev/null
+++ b/FusionIIIT/templates/academic_procedures/replace.html
@@ -0,0 +1,182 @@
+
+
+
+
+{% load static %}
+{% block complainthistory %}
+
+{% comment %}The tab menu starts here!{% endcomment %}
+ Replace Course(s)
+
+
+ {% if adc_date_flag %}
+ {% if details.cpi >= 0.0 %}
+ {% if replace_courses_options %}
+
+ {% else %}
+
+ NO COURSES TO REPLACE
+
+ {% endif %}
+ {% else %}
+
+ You do not have minimum CPI required to add course
+
+ {% endif %}
+ {% else %}
+
+ You have to wait for the date
+
+ {% endif %}
+
+
+{% endblock %}
+
+
+
+
+
+
diff --git a/FusionIIIT/templates/academic_procedures/studentCourses.html b/FusionIIIT/templates/academic_procedures/studentCourses.html
index 7c1a9152c..1a15c3d1a 100644
--- a/FusionIIIT/templates/academic_procedures/studentCourses.html
+++ b/FusionIIIT/templates/academic_procedures/studentCourses.html
@@ -8,6 +8,27 @@
.modal('show')
;
});
+ function courseDropCalled(event) {
+ // Prevent the default action of the link
+ event.preventDefault();
+
+ // Get the URL from the link's href attribute
+ let url = event.target.href;
+
+ // Perform AJAX request
+ $.ajax({
+ url: url,
+ type: 'GET',
+ success: function(data) {
+ // Reload the page after successful deletion
+ location.reload();
+ },
+ error: function(xhr, status, error) {
+ // Handle errors if needed
+ console.error(error);
+ }
+ });
+ }
@@ -81,7 +102,7 @@
|
+ href="/academic-procedures/acad_person/verifyCourse/drop/?id={{ items.reg_id|urlencode }}" onclick="courseDropCalled(event)" >
DROP
|
diff --git a/FusionIIIT/templates/academic_procedures/studentSwayam.html b/FusionIIIT/templates/academic_procedures/studentSwayam.html
new file mode 100644
index 000000000..6a912f3e9
--- /dev/null
+++ b/FusionIIIT/templates/academic_procedures/studentSwayam.html
@@ -0,0 +1,322 @@
+{% load static %}
+
+
+
+
+
+
+ {% if dict2 %}
+
+
+
+
+
+ Name = {{ dict2.firstname }} {{ dict2.lastname }}
+
+
+
+ Roll No = {{ dict2.roll_no }}
+
+ {% endif %}
+ {% if details %}
+
+
+
+
+
+
+ Reg ID#
+ |
+
+
+ Course ID
+ |
+
+
+ Course Name
+ |
+
+
+ Credits
+ |
+
+ Semester
+ |
+
+ Replace Course
+ |
+
+
+
+
+
+
+ {% for items in details %}
+
+
+
+ {{ items.rid }}
+ |
+
+ {{ items.course_id }}
+ |
+
+ {{ items.course_name }}
+ |
+
+ {{ items.credits }}
+ |
+
+ {{ items.sem }}
+ |
+
+
+
+
+ |
+
+
+
+ {% endfor %}
+
+
+
+
+
+
+
+
+
+
+
+
+ {% else %}
+
+
+
+ NO RECORDS FOUND
+
+ {% endif %}
+
+
+ {% comment %}
{% endcomment %}
+
+
+
+
+
+
+
+
+
\ No newline at end of file
diff --git a/FusionIIIT/templates/academic_procedures/student_table.html b/FusionIIIT/templates/academic_procedures/student_table.html
index 00f540dd4..2661cbecc 100755
--- a/FusionIIIT/templates/academic_procedures/student_table.html
+++ b/FusionIIIT/templates/academic_procedures/student_table.html
@@ -78,9 +78,9 @@
Decline |
-
+
{% endif %}
@@ -101,7 +101,8 @@
var student_id = $(this).attr('data');
$.ajax({
type: 'post',
- url: '/academic-procedures/process_verification_request/',
+ // url: '/academic-procedures/process_verification_request/',
+ url: '/academic-procedures/auto_process_verification_request/',
data: {
student_id: student_id,
status_req: 'accept',
@@ -132,7 +133,8 @@
var reason = $('#fname').val();
$.ajax({
type: 'post',
- url: '/academic-procedures/process_verification_request/',
+ // url: '/academic-procedures/process_verification_request/',
+ url: '/academic-procedures/auto_process_verification_request/',
data: {
student_id: student_id,
status_req: 'reject',
diff --git a/FusionIIIT/templates/academic_procedures/swayam_list.html b/FusionIIIT/templates/academic_procedures/swayam_list.html
new file mode 100644
index 000000000..12c50c1de
--- /dev/null
+++ b/FusionIIIT/templates/academic_procedures/swayam_list.html
@@ -0,0 +1,57 @@
+{% comment %} ACAD ADMIN WILL REPLACE COURSES WITH SWAYAM COURSES HERE {% endcomment%}
+{% load static %}
+{% block allot_swayam %}
+
+
+
+
+
+{% comment %}The tab menu starts here!{% endcomment %}
+
+
+
+{% endblock %}
\ No newline at end of file
diff --git a/FusionIIIT/templates/ais/ais.html b/FusionIIIT/templates/ais/ais.html
index da3952064..2a7c4c2ac 100755
--- a/FusionIIIT/templates/ais/ais.html
+++ b/FusionIIIT/templates/ais/ais.html
@@ -47,7 +47,7 @@
@@ -142,7 +146,7 @@
-
+
{% block generateSheet %}
{% include 'ais/generateSheet.html' %}
{% endblock %}
@@ -178,13 +182,13 @@
-
-
-
-
+
+
+
+
-
+
{% block config_pre_registration %}
{% include 'ais/pre_registration_courses.html' %}
{% endblock %}
@@ -196,32 +200,39 @@
{% endblock %}
-
+
{% block branch_change %}
{% include 'academic_procedures/academicadminforbranch.html' %}
{% endblock %}
-
+
{% block courses_list %}
{% include 'academic_procedures/courses_list.html' %}
{% endblock %}
-
-
+
+
{% block allot_courses %}
{% include 'academic_procedures/allot_courses.html' %}
{% endblock %}
-
+
{% block student_dashboard %}
{% include 'ais/student_dashboard.html' %}
{% endblock %}
+
+ {% block allot_swayam %}
+ {% include 'academic_procedures/swayam_list.html' %}
+ {% endblock %}
+
+
+
{% block curriculum %}
{% include 'ais/curriculum.html' %}
diff --git a/FusionIIIT/templates/ais/config_courseslot_courses.html b/FusionIIIT/templates/ais/config_courseslot_courses.html
index 5a0964afc..ca3bcba67 100644
--- a/FusionIIIT/templates/ais/config_courseslot_courses.html
+++ b/FusionIIIT/templates/ais/config_courseslot_courses.html
@@ -42,9 +42,13 @@
{% load static %}
{% block config_courseslot_courses %}
+
-
Update Courses in Course-Slot for upcoming Semester
-