|
41 | 41 | from django.db.models.functions import Concat,ExtractYear,ExtractMonth,ExtractDay,Cast |
42 | 42 | from .api import serializers |
43 | 43 | from django.core.serializers import serialize |
44 | | - |
| 44 | +import datetime |
45 | 45 |
|
46 | 46 | """every newfuncitons that have been created with name auto_ in start of their original name is to implement new logic of registraion .. |
47 | 47 | unlike the previous registration logic that was done with priority """ |
@@ -959,14 +959,14 @@ def verify_course(request): |
959 | 959 | current_user = get_object_or_404(User, username=request.user.username) |
960 | 960 | user_details = ExtraInfo.objects.all().select_related( |
961 | 961 | 'user', 'department').filter(user=current_user).first() |
962 | | - desig_id = Designation.objects.all().filter(name='adminstrator').first() |
| 962 | + desig_id = Designation.objects.all().filter(name='acadadmin').first() |
963 | 963 | temp = HoldsDesignation.objects.all().select_related().filter( |
964 | 964 | designation=desig_id).first() |
965 | 965 | acadadmin = temp.working |
966 | 966 | k = str(user_details).split() |
967 | 967 | final_user = k[2] |
968 | 968 |
|
969 | | - if (str(acadadmin) != str(final_user)): |
| 969 | + if (str(acadadmin) != request.session.get('currentDesignationSelected')): |
970 | 970 | return HttpResponseRedirect('/academic-procedures/') |
971 | 971 | roll_no = request.POST["rollNo"] |
972 | 972 | obj = ExtraInfo.objects.all().select_related( |
@@ -1050,7 +1050,7 @@ def acad_add_course(request): |
1050 | 1050 | sem_id = request.POST['semester_id'] |
1051 | 1051 | semester = Semester.objects.get(id=sem_id) |
1052 | 1052 | cr = course_registration( |
1053 | | - course_id=course, student_id=student, semester_id=semester) |
| 1053 | + course_id=course, student_id=student, semester_id=semester , working_year = datetime.datetime.now().year,) |
1054 | 1054 | cr.save() |
1055 | 1055 |
|
1056 | 1056 | return HttpResponseRedirect('/academic-procedures/') |
@@ -1088,7 +1088,7 @@ def acad_branch_change(request): |
1088 | 1088 | k = str(user_details).split() |
1089 | 1089 | final_user = k[2] |
1090 | 1090 |
|
1091 | | - if (str(acadadmin) != str(final_user)): |
| 1091 | + if (str(acadadmin) != request.session.get('currentDesignationSelected')): |
1092 | 1092 | return HttpResponseRedirect('/academic-procedures/') |
1093 | 1093 |
|
1094 | 1094 | # year = datetime.datetime.now().year |
@@ -1630,7 +1630,7 @@ def user_check(request): |
1630 | 1630 | final_user="" |
1631 | 1631 | pass |
1632 | 1632 |
|
1633 | | - if (str(acadadmin) != str(final_user)): |
| 1633 | + if (str(acadadmin) != request.session.get('currentDesignationSelected')): |
1634 | 1634 | return True |
1635 | 1635 | else: |
1636 | 1636 | return False |
@@ -1718,7 +1718,8 @@ def add_courses(request): |
1718 | 1718 | course_id = course_id, |
1719 | 1719 | student_id=current_user, |
1720 | 1720 | course_slot_id = courseslot_id, |
1721 | | - semester_id=sem_id |
| 1721 | + semester_id=sem_id, |
| 1722 | + working_year = datetime.datetime.now().year, |
1722 | 1723 | ) |
1723 | 1724 | if p not in reg_curr: |
1724 | 1725 | reg_curr.append(p) |
@@ -1924,6 +1925,7 @@ def get_add_course_options(branch_courses, current_register, batch): |
1924 | 1925 | if courseslot not in slots: |
1925 | 1926 | lis = [] |
1926 | 1927 | for course in courseslot.courses.all(): |
| 1928 | + print(course) |
1927 | 1929 | if course_registration.objects.filter(student_id__batch_id__year = batch, course_id = course).count() < max_limit: |
1928 | 1930 | lis.append(course) |
1929 | 1931 | course_option.append((courseslot, lis)) |
@@ -2560,7 +2562,8 @@ def verify_registration(request): |
2560 | 2562 | course_id=obj.course_id, |
2561 | 2563 | student_id=student, |
2562 | 2564 | semester_id=obj.semester_id, |
2563 | | - course_slot_id = obj.course_slot_id |
| 2565 | + course_slot_id = obj.course_slot_id, |
| 2566 | + working_year = datetime.datetime.now().year, |
2564 | 2567 | ) |
2565 | 2568 | ver_reg.append(p) |
2566 | 2569 | o = FinalRegistration.objects.filter(id= obj.id).update(verified = True) |
@@ -3836,7 +3839,8 @@ def add_one_course(request): |
3836 | 3839 | course_id=course_id, |
3837 | 3840 | student_id=current_user, |
3838 | 3841 | course_slot_id=courseslot_id, |
3839 | | - semester_id=sem_id |
| 3842 | + semester_id=sem_id, |
| 3843 | + working_year = datetime.datetime.now().year, |
3840 | 3844 | ) |
3841 | 3845 | p.save() |
3842 | 3846 | return JsonResponse({'message': 'Course added successfully'}) |
@@ -3892,14 +3896,14 @@ def replaceSwayam(request): |
3892 | 3896 | current_user = get_object_or_404(User, username=request.user.username) |
3893 | 3897 | user_details = ExtraInfo.objects.all().select_related( |
3894 | 3898 | 'user', 'department').filter(user=current_user).first() |
3895 | | - desig_id = Designation.objects.all().filter(name='adminstrator').first() |
| 3899 | + desig_id = Designation.objects.all().filter(name='acadadmin').first() |
3896 | 3900 | temp = HoldsDesignation.objects.all().select_related().filter( |
3897 | 3901 | designation=desig_id).first() |
3898 | 3902 | acadadmin = temp.working |
3899 | 3903 | k = str(user_details).split() |
3900 | 3904 | final_user = k[2] |
3901 | 3905 |
|
3902 | | - if (str(acadadmin) != str(final_user)): |
| 3906 | + if (str(acadadmin) != request.session.get('currentDesignationSelected')): |
3903 | 3907 | return HttpResponseRedirect('/academic-procedures/') |
3904 | 3908 | roll_no = request.POST["rollNo"] |
3905 | 3909 | obj = ExtraInfo.objects.all().select_related( |
@@ -4041,7 +4045,7 @@ def swayam_replace(request): |
4041 | 4045 | semester_id = semester_id_model, |
4042 | 4046 | student_id = student_id_model, |
4043 | 4047 | course_slot_id = course_slot_id_model, |
4044 | | - working_year = 1 |
| 4048 | + working_year = datetime.datetime.now().year, |
4045 | 4049 | ) |
4046 | 4050 | obj.save() |
4047 | 4051 |
|
@@ -4086,7 +4090,8 @@ def register_backlog_course(request): |
4086 | 4090 | course_id=course_id, |
4087 | 4091 | student_id=current_user, |
4088 | 4092 | course_slot_id=course_slot_id, |
4089 | | - semester_id=sem_id |
| 4093 | + semester_id=sem_id, |
| 4094 | + working_year = datetime.datetime.now().year, |
4090 | 4095 | ) |
4091 | 4096 | p.save() |
4092 | 4097 | return JsonResponse({'message': 'Successfully Registered Backlog course' }, status=200) |
|
0 commit comments