2828
2929
3030
31- from applications .academic_procedures .views import acad_proced_global_context
31+ from applications .academic_procedures .views import acad_proced_global_context , get_sem_courses
3232from applications .programme_curriculum .models import Batch
3333
3434
@@ -107,7 +107,6 @@ def get_context(request):
107107 # course_type = Constants.COURSE_TYPE
108108 # timetable = Timetable.objects.all()
109109 # exam_t = Exam_timetable.objects.all()
110-
111110 procedures_context = acad_proced_global_context ()
112111
113112 try :
@@ -842,12 +841,16 @@ def generatexlsheet(request):
842841 """
843842 if user_check (request ):
844843 return HttpResponseRedirect ('/academic-procedures/' )
845-
844+ # print(request.POST)
846845 try :
847- batch = request .POST ['batch' ]
848- course = Courses .objects .get (id = request .POST ['course' ])
846+ batch = request .POST ['batch' ]#batch hai year wala (2020 , 21)
847+ course_id = int (request .POST ['course' ]) # id of course in integer
848+ course = course = Courses .objects .get (id = course_id )
849+
850+ # print(course.name)
849851 obj = course_registration .objects .all ().filter (course_id = course )
850852 except Exception as e :
853+ print (str (e ))
851854 batch = ""
852855 course = ""
853856 curr_key = ""
@@ -1029,9 +1032,14 @@ def generate_preregistration_report(request):
10291032 max_width = max (max_width ,len (choices_of_current_student ))
10301033
10311034 for choice in range (1 ,len (choices_of_current_student )+ 1 ):
1032- current_choice = InitialRegistration .objects .get (student_id = student , semester_id__semester_no = sem ,course_slot_id = slot ,priority = choice )
1033- # #print("current choice is ",current_choice)
1034- z .append (str (current_choice .course_id .code )+ "-" + str (current_choice .course_id .name ))
1035+ try :
1036+ current_choice = InitialRegistration .objects .get (student_id = student , semester_id__semester_no = sem , course_slot_id = slot , priority = choice )
1037+ z .append (str (current_choice .course_id .code ) + "-" + str (current_choice .course_id .name ))
1038+ except :
1039+ z .append ("No registration found" )
1040+ # current_choice = InitialRegistration.objects.get(student_id=student, semester_id__semester_no=sem,course_slot_id = slot,priority = choice)
1041+ # # #print("current choice is ",current_choice)
1042+ # z.append(str(current_choice.course_id.code)+"-"+str(current_choice.course_id.name))
10351043
10361044 data .append (z )
10371045 m += 1
@@ -1169,9 +1177,9 @@ def add_new_profile (request):
11691177 }
11701178 if request .method == 'POST' and request .FILES :
11711179 profiles = request .FILES ['profiles' ]
1172- excel = xlrd .open_workbook (file_contents = profiles .read ())
1180+ excel = xlrd .open_workbook (profiles . name , file_contents = profiles .read ())
11731181 sheet = excel .sheet_by_index (0 )
1174- for i in range (sheet .nrows ):
1182+ for i in range (1 , sheet .nrows ):
11751183 roll_no = sheet .cell (i ,0 ).value
11761184 first_name = str (sheet .cell (i ,1 ).value )
11771185 last_name = str (sheet .cell (i ,2 ).value )
@@ -1191,7 +1199,7 @@ def add_new_profile (request):
11911199 category = ""
11921200 phone_no = 0
11931201 address = ""
1194- dept = str (sheet .cell (i ,12 ).value )
1202+ dept = str (sheet .cell (i ,11 ).value )
11951203 specialization = str (sheet .cell (i ,12 ).value )
11961204 hall_no = None
11971205
@@ -1209,14 +1217,14 @@ def add_new_profile (request):
12091217 batch_year = request .POST ['Batch' ]
12101218
12111219 batch = Batch .objects .all ().filter (name = programme_name , discipline__acronym = dept , year = batch_year ).first ()
1212-
12131220 user = User .objects .create_user (
12141221 username = roll_no ,
12151222 password = 'hello123' ,
12161223 first_name = first_name ,
12171224 last_name = last_name ,
12181225 email = email ,
12191226 )
1227+
12201228
12211229 einfo = ExtraInfo .objects .create (
12221230 id = roll_no ,
@@ -1253,6 +1261,11 @@ def add_new_profile (request):
12531261 working = user ,
12541262 designation = desig ,
12551263 )
1264+
1265+ user .save ()
1266+ einfo .save ()
1267+ stud_data .save ()
1268+ hold_des .save ()
12561269
12571270 sem_id = Semester .objects .get (curriculum = batch .curriculum , semester_no = sem )
12581271 course_slots = CourseSlot .objects .all ().filter (semester = sem_id )
@@ -2063,14 +2076,15 @@ def view_all_student_data(request):
20632076 "specailization" : student .specialization ,
20642077 "gender" : student .id .sex ,
20652078 "category" : student .category ,
2066- "pwd_status" : student .pwd_status ,
2079+ # "pwd_status": student.pwd_status,
2080+ "pwd_status" : False ,
20672081 "Mobile" : student .id .phone_no ,
20682082 "dob" : student .id .date_of_birth ,
20692083 "emailid" : student .id .user .email ,
20702084 "father_name" : student .father_name ,
2071- "father_mobile_no" : student .father_mobile_no ,
2085+ # "father_mobile_no": student.father_mobile_no,
20722086 "mother_name" : student .mother_name ,
2073- "mother_mobile_no" : student .mother_mobile_no ,
2087+ # "mother_mobile_no": student.mother_mobile_no,
20742088 "address" : student .id .address
20752089 }
20762090 data .append (obj )
@@ -2140,9 +2154,9 @@ def generatestudentxlsheet(request):
21402154 data = None
21412155 else :
21422156 if (request_rollno != "" ):
2143- 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' )
2157+ 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' )
21442158 else :
2145- 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' )
2159+ 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' )
21462160 for i in students :
21472161 obj = []
21482162 obj .append (i .batch )
@@ -2153,14 +2167,17 @@ def generatestudentxlsheet(request):
21532167 obj .append (i .specialization )
21542168 obj .append (i .id .sex )
21552169 obj .append (i .category )
2156- obj .append (i .pwd_status )
2170+ #obj.append(i.pwd_status)
2171+ obj .append (None )
21572172 obj .append (i .id .phone_no )
21582173 obj .append (i .id .date_of_birth )
21592174 obj .append (i .id .user .email )
21602175 obj .append (i .father_name )
2161- obj .append (i .father_mobile_no )
2176+ #obj.append(i.father_mobile_no)
2177+ obj .append (None )
21622178 obj .append (i .mother_name )
2163- obj .append (i .mother_mobile_no )
2179+ # obj.append(i.mother_mobile_no)
2180+ obj .append (None )
21642181 obj .append (i .id .address )
21652182 data .append (obj )
21662183 data .sort ()
0 commit comments