From 18b8792475ca8ea5f24b61c5e5edfd63c6f59bfa Mon Sep 17 00:00:00 2001 From: grvup <128596203+grvup@users.noreply.github.com> Date: Mon, 4 Nov 2024 11:22:56 +0530 Subject: [PATCH] AC-1 bug fix (#1642) * resolved issue with course max_seats --- FusionIIIT/applications/programme_curriculum/forms.py | 4 +++- FusionIIIT/applications/programme_curriculum/views.py | 6 +++--- .../programme_curriculum/acad_admin/course_form.html | 5 +++++ 3 files changed, 11 insertions(+), 4 deletions(-) diff --git a/FusionIIIT/applications/programme_curriculum/forms.py b/FusionIIIT/applications/programme_curriculum/forms.py index 38d6b9e11..667178582 100644 --- a/FusionIIIT/applications/programme_curriculum/forms.py +++ b/FusionIIIT/applications/programme_curriculum/forms.py @@ -174,6 +174,7 @@ class Meta: 'percent_project' : forms.NumberInput(attrs={'placeholder': '%'}, ), 'percent_lab_evaluation' : forms.NumberInput(attrs={'placeholder': '%'}, ), 'percent_course_attendance' : forms.NumberInput(attrs={'placeholder': '%'}, ), + 'max_seats' : forms.NumberInput(attrs={'placeholder': 'max_seats',}, ), } labels = { 'code' : 'Course Code', @@ -197,7 +198,8 @@ class Meta: 'percent_lab_evaluation' : 'percent_lab_evaluation', 'percent_course_attendance' : 'percent_course_attendance', 'working_course' : 'working_course', - 'disciplines' : 'disciplines' + 'disciplines' : 'disciplines', + 'max_seats' : 'max_seats' } diff --git a/FusionIIIT/applications/programme_curriculum/views.py b/FusionIIIT/applications/programme_curriculum/views.py index dda6eeb38..a7ba330a7 100644 --- a/FusionIIIT/applications/programme_curriculum/views.py +++ b/FusionIIIT/applications/programme_curriculum/views.py @@ -845,7 +845,7 @@ def update_course_form(request, course_id): ver=0 if(new_course.version>previous.version): # Check if a course with the same values (except version, latest_version, disciplines, and pre_requisit_courses) already exists - old_course=Course.objects.filter(code=new_course.code, name=new_course.name, credit=new_course.credit, lecture_hours=new_course.lecture_hours, tutorial_hours=new_course.tutorial_hours, pratical_hours=new_course.pratical_hours, discussion_hours=new_course.discussion_hours, project_hours=new_course.project_hours, pre_requisits=new_course.pre_requisits, syllabus=new_course.syllabus, percent_quiz_1=new_course.percent_quiz_1, percent_midsem=new_course.percent_midsem, percent_quiz_2=new_course.percent_quiz_2, percent_endsem=new_course.percent_endsem, percent_project=new_course.percent_project, percent_lab_evaluation=new_course.percent_lab_evaluation, percent_course_attendance=new_course.percent_course_attendance, ref_books=new_course.ref_books) + old_course=Course.objects.filter(code=new_course.code, name=new_course.name, credit=new_course.credit, lecture_hours=new_course.lecture_hours, tutorial_hours=new_course.tutorial_hours, pratical_hours=new_course.pratical_hours, discussion_hours=new_course.discussion_hours, project_hours=new_course.project_hours, pre_requisits=new_course.pre_requisits, syllabus=new_course.syllabus, percent_quiz_1=new_course.percent_quiz_1, percent_midsem=new_course.percent_midsem, percent_quiz_2=new_course.percent_quiz_2, percent_endsem=new_course.percent_endsem, percent_project=new_course.percent_project, percent_lab_evaluation=new_course.percent_lab_evaluation, percent_course_attendance=new_course.percent_course_attendance, ref_books=new_course.ref_books,max_seats=new_course.max_seats) if old_course: # Check if disciplines or pre_requisit_courses have been changed for i in old_course: @@ -1657,7 +1657,7 @@ def add_course_instructor(request): form = CourseInstructorForm(request.POST) if form.is_valid(): form.save() # Save the form data to the database - return redirect('/programme_curriculum/') # Redirect to a success page after saving + return redirect('/programme_curriculum/admin_instructor/') # Redirect to a success page after saving else: form = CourseInstructorForm() @@ -1692,7 +1692,7 @@ def update_course_instructor_form(request, instructor_id): form = CourseInstructorForm(request.POST, instance=course_instructor) if form.is_valid(): form.save() # Save the updated data to the database - return redirect('/programme_curriculum/') # Redirect after successful update + return redirect('/programme_curriculum/admin_instructor/') # Redirect after successful update else: # Create the form with existing data (pre-populated) form = CourseInstructorForm(instance=course_instructor) diff --git a/FusionIIIT/templates/programme_curriculum/acad_admin/course_form.html b/FusionIIIT/templates/programme_curriculum/acad_admin/course_form.html index aeb2779df..a45b5843f 100644 --- a/FusionIIIT/templates/programme_curriculum/acad_admin/course_form.html +++ b/FusionIIIT/templates/programme_curriculum/acad_admin/course_form.html @@ -189,6 +189,11 @@ {{ form.percent_course_attendance }} +