From 32870efd18cf230852a11beee694cf4dcec997d6 Mon Sep 17 00:00:00 2001 From: karthikmurakonda Date: Thu, 19 Oct 2023 03:09:01 +0530 Subject: [PATCH] clean up --- CDC_Backend/APIs/admin.py | 8 ++++---- CDC_Backend/APIs/adminViews.py | 6 +++--- CDC_Backend/APIs/constants.py | 4 ++-- CDC_Backend/APIs/studentViews.py | 2 +- CDC_Backend/APIs/utils.py | 4 ---- 5 files changed, 10 insertions(+), 14 deletions(-) diff --git a/CDC_Backend/APIs/admin.py b/CDC_Backend/APIs/admin.py index a14a7d9..e44b2ea 100644 --- a/CDC_Backend/APIs/admin.py +++ b/CDC_Backend/APIs/admin.py @@ -149,8 +149,8 @@ class InternshipApplicationAdmin(ExportMixin, SimpleHistoryAdmin): @admin.register(PlacementApplication) class PlacementApplication(PlacementAdmin): list_display = ('id', 'Placement', 'Student', 'selected') - search_fields = ('id',) - ordering = ('id',) + search_fields = ('id','Placement', 'Student') + ordering = ('id','Placement', 'Student') list_filter = ('selected',) def Placement(self, obj): @@ -161,8 +161,8 @@ class PlacementApplication(PlacementAdmin): @admin.register(InternshipApplication) class InternshipApplication(InternshipApplicationAdmin): list_display = ('id', 'Internship', 'Student', 'selected') - search_fields = ('id',) - ordering = ('id',) + search_fields = ('id', 'Internship', 'Student') + ordering = ('id', 'Internship', 'Student') list_filter = ('selected',) def Internship(self, obj): diff --git a/CDC_Backend/APIs/adminViews.py b/CDC_Backend/APIs/adminViews.py index 50a5ad8..429260e 100644 --- a/CDC_Backend/APIs/adminViews.py +++ b/CDC_Backend/APIs/adminViews.py @@ -20,10 +20,7 @@ def markStatus(request, id, email, user_type): applications = InternshipApplication.objects.filter(internship_id=data[OPENING_ID]) else: applications = PlacementApplication.objects.filter(placement_id=data[OPENING_ID]) - # Getting all application from db for this opening - # applications = PlacementApplication.objects.filter(placement_id=data[OPENING_ID]) for i in data[STUDENT_LIST]: - # print(i[STUDENT_ID]) issue is using student id instead of roll no both may not be same #remember this application = applications.filter(student__roll_no=i[STUDENT_ID]) # Filtering student's application if len(application) > 0: application = application[0] @@ -565,6 +562,7 @@ def getStats(request, id, email, user_type): "5":0, "6":0, "7":0, + "8":0, "psu":0, }, "EE": { @@ -585,6 +583,7 @@ def getStats(request, id, email, user_type): "5":0, "6":0, "7":0, + "8":0, "psu":0, }, @@ -596,6 +595,7 @@ def getStats(request, id, email, user_type): "5":0, "6":0, "7":0, + "8":0, "psu":0, }, } diff --git a/CDC_Backend/APIs/constants.py b/CDC_Backend/APIs/constants.py index 8ebfcf1..12ac4fb 100644 --- a/CDC_Backend/APIs/constants.py +++ b/CDC_Backend/APIs/constants.py @@ -74,8 +74,8 @@ CDC_REPS_EMAILS = [ "ramesh.nayaka@iitdh.ac.in" ] CDC_REPS_EMAILS_FOR_ISSUE=[ #add reps emails - "support.cdc@iitdh.ac.in" - "irontwist00@gmail.com" + "cdc.support@iitdh.ac.in", + "cdc@iitdh.ac.in" ] # To be Configured Properly diff --git a/CDC_Backend/APIs/studentViews.py b/CDC_Backend/APIs/studentViews.py index c269a50..f373ca8 100644 --- a/CDC_Backend/APIs/studentViews.py +++ b/CDC_Backend/APIs/studentViews.py @@ -179,7 +179,7 @@ def submitApplication(request, id, email, user_type): # Only Allowing Applications for Placements if data[OPENING_TYPE] == PLACEMENT: - if not student.can_apply: #why not checking in admin + if not student.can_apply: return Response({'action': "Submit Application", 'message': "Student Can't Apply"}, status=status.HTTP_400_BAD_REQUEST) if not len(PlacementApplication.objects.filter( diff --git a/CDC_Backend/APIs/utils.py b/CDC_Backend/APIs/utils.py index 69e97a2..10f1c0c 100644 --- a/CDC_Backend/APIs/utils.py +++ b/CDC_Backend/APIs/utils.py @@ -112,12 +112,10 @@ def isAuthorized(allowed_users=None): def wrapper_func(request, *args, **kwargs): try: headers = request.META - #print(headers) if 'HTTP_AUTHORIZATION' in headers: token_id = headers['HTTP_AUTHORIZATION'][7:] idinfo = id_token.verify_oauth2_token(token_id, requests.Request(), CLIENT_ID) email = idinfo[EMAIL] - # print(idinfo) user = get_object_or_404(User, email=email) if user: user.last_login_time = timezone.now() @@ -169,8 +167,6 @@ def saveFile(file, location): file_name = re.sub(r'[\\/:*?"<>|]', '_', file_name) - # print("Inside saveFile: " + str(file_name)) - if not path.isdir(location): os.makedirs(location)