This commit is contained in:
karthikmurakonda 2023-10-19 03:09:01 +05:30
parent 653755d4c9
commit 32870efd18
5 changed files with 10 additions and 14 deletions

View File

@ -149,8 +149,8 @@ class InternshipApplicationAdmin(ExportMixin, SimpleHistoryAdmin):
@admin.register(PlacementApplication) @admin.register(PlacementApplication)
class PlacementApplication(PlacementAdmin): class PlacementApplication(PlacementAdmin):
list_display = ('id', 'Placement', 'Student', 'selected') list_display = ('id', 'Placement', 'Student', 'selected')
search_fields = ('id',) search_fields = ('id','Placement', 'Student')
ordering = ('id',) ordering = ('id','Placement', 'Student')
list_filter = ('selected',) list_filter = ('selected',)
def Placement(self, obj): def Placement(self, obj):
@ -161,8 +161,8 @@ class PlacementApplication(PlacementAdmin):
@admin.register(InternshipApplication) @admin.register(InternshipApplication)
class InternshipApplication(InternshipApplicationAdmin): class InternshipApplication(InternshipApplicationAdmin):
list_display = ('id', 'Internship', 'Student', 'selected') list_display = ('id', 'Internship', 'Student', 'selected')
search_fields = ('id',) search_fields = ('id', 'Internship', 'Student')
ordering = ('id',) ordering = ('id', 'Internship', 'Student')
list_filter = ('selected',) list_filter = ('selected',)
def Internship(self, obj): def Internship(self, obj):

View File

@ -20,10 +20,7 @@ def markStatus(request, id, email, user_type):
applications = InternshipApplication.objects.filter(internship_id=data[OPENING_ID]) applications = InternshipApplication.objects.filter(internship_id=data[OPENING_ID])
else: else:
applications = PlacementApplication.objects.filter(placement_id=data[OPENING_ID]) 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]: 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 application = applications.filter(student__roll_no=i[STUDENT_ID]) # Filtering student's application
if len(application) > 0: if len(application) > 0:
application = application[0] application = application[0]
@ -565,6 +562,7 @@ def getStats(request, id, email, user_type):
"5":0, "5":0,
"6":0, "6":0,
"7":0, "7":0,
"8":0,
"psu":0, "psu":0,
}, },
"EE": { "EE": {
@ -585,6 +583,7 @@ def getStats(request, id, email, user_type):
"5":0, "5":0,
"6":0, "6":0,
"7":0, "7":0,
"8":0,
"psu":0, "psu":0,
}, },
@ -596,6 +595,7 @@ def getStats(request, id, email, user_type):
"5":0, "5":0,
"6":0, "6":0,
"7":0, "7":0,
"8":0,
"psu":0, "psu":0,
}, },
} }

View File

@ -74,8 +74,8 @@ CDC_REPS_EMAILS = [
"ramesh.nayaka@iitdh.ac.in" "ramesh.nayaka@iitdh.ac.in"
] ]
CDC_REPS_EMAILS_FOR_ISSUE=[ #add reps emails CDC_REPS_EMAILS_FOR_ISSUE=[ #add reps emails
"support.cdc@iitdh.ac.in" "cdc.support@iitdh.ac.in",
"irontwist00@gmail.com" "cdc@iitdh.ac.in"
] ]
# To be Configured Properly # To be Configured Properly

View File

@ -179,7 +179,7 @@ def submitApplication(request, id, email, user_type):
# Only Allowing Applications for Placements # Only Allowing Applications for Placements
if data[OPENING_TYPE] == PLACEMENT: 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"}, return Response({'action': "Submit Application", 'message': "Student Can't Apply"},
status=status.HTTP_400_BAD_REQUEST) status=status.HTTP_400_BAD_REQUEST)
if not len(PlacementApplication.objects.filter( if not len(PlacementApplication.objects.filter(

View File

@ -112,12 +112,10 @@ def isAuthorized(allowed_users=None):
def wrapper_func(request, *args, **kwargs): def wrapper_func(request, *args, **kwargs):
try: try:
headers = request.META headers = request.META
#print(headers)
if 'HTTP_AUTHORIZATION' in headers: if 'HTTP_AUTHORIZATION' in headers:
token_id = headers['HTTP_AUTHORIZATION'][7:] token_id = headers['HTTP_AUTHORIZATION'][7:]
idinfo = id_token.verify_oauth2_token(token_id, requests.Request(), CLIENT_ID) idinfo = id_token.verify_oauth2_token(token_id, requests.Request(), CLIENT_ID)
email = idinfo[EMAIL] email = idinfo[EMAIL]
# print(idinfo)
user = get_object_or_404(User, email=email) user = get_object_or_404(User, email=email)
if user: if user:
user.last_login_time = timezone.now() user.last_login_time = timezone.now()
@ -169,8 +167,6 @@ def saveFile(file, location):
file_name = re.sub(r'[\\/:*?"<>|]', '_', file_name) file_name = re.sub(r'[\\/:*?"<>|]', '_', file_name)
# print("Inside saveFile: " + str(file_name))
if not path.isdir(location): if not path.isdir(location):
os.makedirs(location) os.makedirs(location)