commit
734d505052
|
@ -4,5 +4,6 @@ from . import adminViews
|
||||||
|
|
||||||
urlpatterns = [
|
urlpatterns = [
|
||||||
path('markStatus/', adminViews.markStatus, name="Mark Status"),
|
path('markStatus/', adminViews.markStatus, name="Mark Status"),
|
||||||
|
path('getDashboard/', adminViews.getDashboard, name="Get Dashboard"),
|
||||||
|
|
||||||
]
|
]
|
||||||
|
|
|
@ -1,6 +1,8 @@
|
||||||
from .utils import *
|
from .utils import *
|
||||||
from rest_framework.decorators import api_view
|
from rest_framework.decorators import api_view
|
||||||
|
|
||||||
|
from .serializers import *
|
||||||
|
|
||||||
|
|
||||||
@api_view(['POST'])
|
@api_view(['POST'])
|
||||||
@isAuthorized([ADMIN])
|
@isAuthorized([ADMIN])
|
||||||
|
@ -42,3 +44,26 @@ def markStatus(request, id, email, user_type):
|
||||||
logger.warning("Mark Status: " + str(sys.exc_info()))
|
logger.warning("Mark Status: " + str(sys.exc_info()))
|
||||||
return Response({'action': "Mark Status", 'message': "Error Occurred!"},
|
return Response({'action': "Mark Status", 'message': "Error Occurred!"},
|
||||||
status=status.HTTP_400_BAD_REQUEST)
|
status=status.HTTP_400_BAD_REQUEST)
|
||||||
|
|
||||||
|
|
||||||
|
@api_view(['GET'])
|
||||||
|
@isAuthorized([ADMIN])
|
||||||
|
def getDashboard(request, id, email, user_type):
|
||||||
|
try:
|
||||||
|
|
||||||
|
placements = Placement.objects.all()
|
||||||
|
ongoing = placements.filter(status=STATUS_ACCEPTING_APPLICATIONS)
|
||||||
|
previous = placements.exclude(status = STATUS_ACCEPTING_APPLICATIONS)
|
||||||
|
ongoing = PlacementSerializer(ongoing, many=True).data
|
||||||
|
previous = PlacementSerializer(previous, many=True).data
|
||||||
|
|
||||||
|
return Response(
|
||||||
|
{'action': "Placement and Internships", 'message': "Data Found", "ongoing": ongoing, "previous": previous},
|
||||||
|
status=status.HTTP_200_OK)
|
||||||
|
except Http404:
|
||||||
|
return Response({'action': "Placements and Internships", 'message': 'Student Not Found'},
|
||||||
|
status=status.HTTP_404_NOT_FOUND)
|
||||||
|
except:
|
||||||
|
logger.warning("Placements and Internships: " + str(sys.exc_info()))
|
||||||
|
return Response({'action': "Placements and Internships", 'message': "Error Occurred"},
|
||||||
|
status=status.HTTP_400_BAD_REQUEST)
|
||||||
|
|
Loading…
Reference in New Issue