Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
@@ -0,0 +1,14 @@
# Generated by Django 3.1.5 on 2024-11-18 19:14

from django.db import migrations


class Migration(migrations.Migration):

dependencies = [
('central_mess', '0006_auto_20241116_0306'),
('central_mess', '0005_merge_20241116_0233'),
]

operations = [
]
Original file line number Diff line number Diff line change
@@ -0,0 +1,14 @@
# Generated by Django 3.1.5 on 2024-11-18 19:14

from django.db import migrations


class Migration(migrations.Migration):

dependencies = [
('globals', '0006_merge_20241116_0233'),
('globals', '0006_merge_20241116_0303'),
]

operations = [
]
Original file line number Diff line number Diff line change
@@ -0,0 +1,14 @@
# Generated by Django 3.1.5 on 2024-11-18 19:14

from django.db import migrations


class Migration(migrations.Migration):

dependencies = [
('online_cms', '0005_merge_20241116_0303'),
('online_cms', '0005_merge_20241116_0233'),
]

operations = [
]
Original file line number Diff line number Diff line change
@@ -0,0 +1,14 @@
# Generated by Django 3.1.5 on 2024-11-18 19:14

from django.db import migrations


class Migration(migrations.Migration):

dependencies = [
('research_procedures', '0004_merge_20241116_0232'),
('research_procedures', '0004_merge_20241116_0303'),
]

operations = [
]
99 changes: 55 additions & 44 deletions FusionIIIT/applications/scholarships/api/views.py
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,7 @@
from django.shortcuts import get_object_or_404


#This api is for invite application
class ReleaseCreateView(APIView):
def post(self, request):
serializer = ReleaseSerializer(data=request.data)
Expand All @@ -21,23 +22,31 @@ def post(self, request):




class AwardAndScholarshipCreateView(APIView):
def post(self, request):

serializer = AwardAndScholarshipSerializer(data=request.data)
#This API is for editing the catalogue by convenor and assistant and saving in the database
class AwardAndScholarshipCreateView(APIView):
def post(self, request, pk=None):
# Check if pk is provided, if yes, try to update the existing entry
pk=request.data.get("id")
if pk is not None:
award = get_object_or_404(Award_and_scholarship, pk=pk)
# Update the existing entry
serializer = AwardAndScholarshipSerializer(award, data=request.data, partial=True)
else:
# If pk is not provided, create a new entry
serializer = AwardAndScholarshipSerializer(data=request.data)

if serializer.is_valid():
# Save the new entry to the database
serializer.save()
return Response(serializer.data, status=status.HTTP_201_CREATED) # 201 Created response
return Response(serializer.errors, status=status.HTTP_400_BAD_REQUEST) # 400 Bad Request if data is invalid

status_code = status.HTTP_200_OK if pk is not None else status.HTTP_201_CREATED
return Response(serializer.data, status=status_code)

return Response(serializer.errors, status=status.HTTP_400_BAD_REQUEST)





#This api for fetching the award and scholarship catalogue from the database
class create_award(APIView):

def get(self, request, *args, **kwargs):
Expand All @@ -46,7 +55,7 @@ def get(self, request, *args, **kwargs):
return Response(serializer.data, status=status.HTTP_200_OK)



#This api is for Previous Winner
class GetWinnersView(APIView):

def post(self, request, *args, **kwargs):
Expand Down Expand Up @@ -138,6 +147,7 @@ def post(self, request):
director_silver_instance = serializer.save()
return Response(DirectorSilverSerializer(director_silver_instance).data, status=status.HTTP_201_CREATED)
return Response(serializer.errors, status=status.HTTP_400_BAD_REQUEST)

class DirectorGoldRetrieveView(APIView):
def post(self, request):
roll_number = request.data.get('roll_number')
Expand Down Expand Up @@ -189,7 +199,7 @@ def post(self, request):

return Response(serializer.data, status=status.HTTP_200_OK)


#This api for showing the list of student who has applied for mcm scholarship to convenor assistant
class ScholarshipDetailView(APIView):
def get(self, request):
# Fetch all records from the Mcm table
Expand All @@ -208,8 +218,10 @@ def get(self, request):
serializer = DirectorGoldSerializer(director_gold_entries, many=True)
# Return the serialized data as a response
return Response(serializer.data, status=status.HTTP_200_OK)




#This api is for showing the all the documnet to the convenor or assistant submitted by the student in browse application
class StudentDetailView(APIView):
def post(self, request):
student_id = request.data.get('student')
Expand All @@ -224,7 +236,7 @@ def post(self, request):
serializer = McmSerializer(mcm_entry)
return Response(serializer.data, status=status.HTTP_200_OK)


#This api is for showing the list of student who has applied for director silver in browse application in convenor and assistant
class DirectorSilverDetailView(APIView):
def post(self, request):
student_id = request.data.get('student')
Expand All @@ -241,7 +253,7 @@ def post(self, request):
return Response(serializer.data, status=status.HTTP_200_OK)



#This api is for showing the list of student who has applied for director gold in browse application in convenor and assistant
class DirectorGoldDetailView(APIView):
def post(self, request):
student_id = request.data.get('student')
Expand Down Expand Up @@ -308,7 +320,6 @@ def post(self, request):


##This api for Director gold accepting and rejecting the application by convenor and assistant

class DirectorGoldAcceptRejectView(APIView):
def post(self, request):
# Get the ID of the Director_gold entry to update
Expand Down Expand Up @@ -338,7 +349,7 @@ def post(self, request):
serializer = DirectorGoldSerializer(director_gold)
return Response(serializer.data, status=status.HTTP_200_OK)


#API View to list all entries of the Director_silver model.
class DirectorSilverListView(APIView):
"""
API View to list all entries of the Director_silver model.
Expand All @@ -348,31 +359,31 @@ def get(self, request):
serializer = DirectorSilverSerializer(director_silver_entries, many=True)
return Response(serializer.data, status=status.HTTP_200_OK)

class DirectorSilverAcceptRejectView(APIView):
def post(self, request):
# Get the ID of the Director_silver entry to update
director_silver_id = request.data.get('id')
action = request.data.get('action') # 'accept' or 'reject'

# Check if the action is valid
if action not in ['accept', 'reject']:
return Response({'error': 'Invalid action. Choose either "accept" or "reject".'}, status=status.HTTP_400_BAD_REQUEST)

try:
# Fetch the Director_silver entry from the database using the ID
director_silver = Director_silver.objects.get(id=director_silver_id)
except Director_silver.DoesNotExist:
return Response({'error': 'Director_silver entry not found.'}, status=status.HTTP_404_NOT_FOUND)

# Update the status based on the action
if action == 'accept':
director_silver.status = 'ACCEPTED'
else:
director_silver.status = 'REJECTED'

# Save the updated Director_silver entry
director_silver.save()

# Return the updated entry as a response
serializer = DirectorSilverSerializer(director_silver)
return Response(serializer.data, status=status.HTTP_200_OK)
# class DirectorSilverAcceptRejectView(APIView):
# def post(self, request):
# # Get the ID of the Director_silver entry to update
# director_silver_id = request.data.get('id')
# action = request.data.get('action') # 'accept' or 'reject'

# # Check if the action is valid
# if action not in ['accept', 'reject']:
# return Response({'error': 'Invalid action. Choose either "accept" or "reject".'}, status=status.HTTP_400_BAD_REQUEST)

# try:
# # Fetch the Director_silver entry from the database using the ID
# director_silver = Director_silver.objects.get(id=director_silver_id)
# except Director_silver.DoesNotExist:
# return Response({'error': 'Director_silver entry not found.'}, status=status.HTTP_404_NOT_FOUND)

# # Update the status based on the action
# if action == 'accept':
# director_silver.status = 'ACCEPTED'
# else:
# director_silver.status = 'REJECTED'

# # Save the updated Director_silver entry
# director_silver.save()

# # Return the updated entry as a response
# serializer = DirectorSilverSerializer(director_silver)
# return Response(serializer.data, status=status.HTTP_200_OK)
7 changes: 4 additions & 3 deletions FusionIIIT/applications/scholarships/urls.py
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,8 @@
from . import views
from applications.scholarships.api.views import GetWinnersView
from applications.scholarships.api.views import create_award,McmUpdateView, McmRetrieveView, DirectorSilverRetrieveView,DirectorSilverUpdateView,DirectorGoldRetrieveView,DirectorGoldUpdateView,ProficiencyDmRetrieveView,ProficiencyDmUpdateView,AwardAndScholarshipCreateView
from applications.scholarships.api.views import ScholarshipDetailView,StudentDetailView,DirectorSilverDetailView,DirectorGoldDetailView,DirectorGoldListView,ReleaseCreateView,McmStatusUpdateView,DirectorSilverDecisionView,DirectorGoldAcceptRejectView,DirectorSilverListView,DirectorSilverAcceptRejectView
from applications.scholarships.api.views import ScholarshipDetailView,StudentDetailView,DirectorSilverDetailView,DirectorGoldDetailView,DirectorGoldListView,ReleaseCreateView,McmStatusUpdateView,DirectorSilverDecisionView,DirectorGoldAcceptRejectView,DirectorSilverListView
# ,DirectorSilverAcceptRejectView



Expand Down Expand Up @@ -45,10 +46,10 @@
path('director_gold_view/', DirectorGoldDetailView.as_view(), name='director_gold_detail'),
path('release', ReleaseCreateView.as_view(), name='release_create'),

url(r'student_file_show/', StudentDetailView.as_view(), name='student-file-show'),
# url(r'student_file_show/', StudentDetailView.as_view(), name='student-file-show'),
path('mcm/status-update/', McmStatusUpdateView.as_view(), name='mcm-status-update'),
path('api/director_silver/decision/', DirectorSilverDecisionView.as_view(), name='director_silver_decision'),
path('director-gold/accept-reject/', DirectorGoldAcceptRejectView.as_view(), name='director-gold-accept-reject'),
path('director-silver/', DirectorSilverListView.as_view(), name='director-silver-list'),
path('director-silver/accept-reject/', DirectorSilverAcceptRejectView.as_view(), name='director-silver-accept-reject'),
# path('director-silver/accept-reject/', DirectorSilverAcceptRejectView.as_view(), name='director-silver-accept-reject'),
]