def assessment(request): if request.method == 'POST': faculty_id = request.user.username course_id = request.POST.get('course-id') sectionNo = request.POST.get('section') coMarks = request.POST.getlist('coMarks') section_id = None try: section_id = Section_T.objects.raw(''' SELECT * FROM mainapp_section_t WHERE course_id = '{}' AND sectionNo = {}; '''.format(course_id, sectionNo)) section_id = section_id[0].id except: section_id = None if section_id is None: section = Section_T(sectionNo=sectionNo, course_id=course_id, faculty_id=faculty_id) section.save() section_id = section.id for j in range(1, len(coMarks) + 1): co_id = CO_T.objects.raw(''' SELECT * FROM mainapp_co_t WHERE course_id = '{}' AND coNo = {} '''.format(course_id, j)) assessment = Assessment_T(section_id=section_id, co_id=co_id[0].id, marks=coMarks[j - 1]) assessment.save() return redirect('dataentry')
faculty.save() # Course for i in datalist: course = Course_T(courseID=i[1], program_id='BSc', noOfCredits=3) course.save() # Sections sections = [] for i in datalist: if i[2] not in sections: sections.append(i[2]) for i in sections: section = Section_T(sectionNo=i, course_id='CSE303', faculty_id='1234') section.save() # Student student = Student_T(studentID='1820750', fname='Mayabee', lname='Tahsin', department_id='CSE', program_id='BSc') student.save() for i in datalist: student = Student_T(studentID=i[0], department_id='CSE', program_id='BSc') student.save()
# for i in datalist: # course = Course_T(courseID=i[1], program_id='BSc', noOfCredits=3) # course.save() course = Course_T(courseNameAll, program_id='BSc', noOfCredits=3) course.save() # Sections sections = [] for i in datalist: if i[2] not in sections: sections.append(i[2]) for i in sections: section = Section_T(sectionNo=i, course_id=courseNameAll, faculty_id=facultyIDNum) section.save() # Student # student = Student_T(studentID='1820750', fname='Mayabee', lname='Tahsin', department_id='CSE', program_id='BSc') # student.save() # for i in datalist: # student = Student_T(studentID=i[0], department_id='CSE', program_id='BSc') # student.save() # Enrollment for i in datalist:
# for i in datalist: # course = Course_T(courseID=i[1], program_id='BSc', noOfCredits=3) # course.save() course = Course_T('CSE101', program_id='BSc', noOfCredits=3) course.save() # Sections sections = [] for i in datalist: if i[2] not in sections: sections.append(i[2]) for i in sections: section = Section_T(sectionNo=i, course_id='CSE101', faculty_id='4321') section.save() # Student # student = Student_T(studentID='1820750', fname='Mayabee', lname='Tahsin', department_id='CSE', program_id='BSc') # student.save() # for i in datalist: # student = Student_T(studentID=i[0], department_id='CSE', program_id='BSc') # student.save() # Enrollment
# for i in datalist: # course = Course_T(courseID=i[1], program_id='BSc', noOfCredits=3) # course.save() course = Course_T('CSE104', program_id='BSc', noOfCredits=3) course.save() # Sections sections = [] for i in datalist: if i[2] not in sections: sections.append(i[2]) for i in sections: section = Section_T(sectionNo=i, course_id='CSE104', faculty_id='1235') section.save() # Student # student = Student_T(studentID='1820750', fname='Mayabee', lname='Tahsin', department_id='CSE', program_id='BSc') # student.save() # for i in datalist: # student = Student_T(studentID=i[0], department_id='CSE', program_id='BSc') # student.save() # Enrollment