forked from FusionIIIT/Fusion
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Latest Updated Commit on 10th march (FusionIIIT#1320)
* first commit * Showing data on Frontend * Latest Code 10th march * Latest updatedt commit on 10th march * Removed Migration files * Removed migration files from globals
- Loading branch information
1 parent
db82cee
commit c621a94
Showing
29 changed files
with
1,086 additions
and
665 deletions.
There are no files selected for viewing
359 changes: 180 additions & 179 deletions
359
FusionIIIT/applications/academic_information/api/views.py
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,181 +1,182 @@ | ||
# from django.contrib.auth import get_user_model | ||
# from django.contrib.auth.decorators import login_required | ||
# from applications.globals.models import (HoldsDesignation,Designation) | ||
# from django.shortcuts import get_object_or_404 | ||
# from django.forms.models import model_to_dict | ||
# from rest_framework.permissions import IsAuthenticated | ||
# from rest_framework.authentication import TokenAuthentication | ||
# from rest_framework import status | ||
# from rest_framework.decorators import api_view, permission_classes,authentication_classes | ||
# from rest_framework.permissions import AllowAny | ||
# from rest_framework.response import Response | ||
# from applications.globals.models import User,ExtraInfo | ||
# from applications.academic_information.models import Student, Course, Curriculum, Curriculum_Instructor, Student_attendance, Meeting, Calendar, Holiday, Grades, Spi, Timetable, Exam_timetable | ||
# from . import serializers | ||
|
||
# @api_view(['GET']) | ||
from django.contrib.auth import get_user_model | ||
from django.contrib.auth.decorators import login_required | ||
from applications.globals.models import (HoldsDesignation,Designation) | ||
from django.shortcuts import get_object_or_404 | ||
from django.forms.models import model_to_dict | ||
from rest_framework.permissions import IsAuthenticated | ||
from rest_framework.authentication import TokenAuthentication | ||
from rest_framework import status | ||
from rest_framework.decorators import api_view, permission_classes,authentication_classes | ||
from rest_framework.permissions import AllowAny | ||
from rest_framework.response import Response | ||
from applications.globals.models import User,ExtraInfo | ||
from applications.academic_information.models import Student, Course, Curriculum, Curriculum_Instructor, Student_attendance, Meeting, Calendar, Holiday, Grades, Spi, Timetable, Exam_timetable | ||
from . import serializers | ||
|
||
@api_view(['GET']) | ||
@permission_classes([IsAuthenticated]) | ||
@authentication_classes([TokenAuthentication]) | ||
def student_api(request): | ||
|
||
if request.method == 'GET': | ||
student = Student.objects.all() | ||
student_serialized = serializers.StudentSerializers(student,many=True).data | ||
resp = { | ||
'students' : student_serialized, | ||
} | ||
return Response(data=resp,status=status.HTTP_200_OK) | ||
|
||
|
||
@api_view(['GET']) | ||
# @permission_classes([IsAuthenticated]) | ||
# @authentication_classes([TokenAuthentication]) | ||
# def student_api(request): | ||
|
||
# if request.method == 'GET': | ||
# student = Student.objects.all() | ||
# student_serialized = serializers.StudentSerializers(student,many=True).data | ||
# resp = { | ||
# 'students' : student_serialized, | ||
# } | ||
# return Response(data=resp,status=status.HTTP_200_OK) | ||
|
||
|
||
# @api_view(['GET']) | ||
# @permission_classes([IsAuthenticated]) | ||
# @authentication_classes([TokenAuthentication]) | ||
# def course_api(request): | ||
|
||
# if request.method == 'GET': | ||
# course = Course.objects.all() | ||
# course_serialized = serializers.CourseSerializer(course,many=True).data | ||
# resp = { | ||
# 'courses' : course_serialized, | ||
# } | ||
# return Response(data=resp,status=status.HTTP_200_OK) | ||
|
||
|
||
# @api_view(['GET']) | ||
# @permission_classes([IsAuthenticated]) | ||
# @authentication_classes([TokenAuthentication]) | ||
# def curriculum_api(request): | ||
|
||
# if request.method == 'GET': | ||
# curriculum = Curriculum.objects.all() | ||
# curriculum_serialized = serializers.CurriculumSerializer(curriculum,many=True).data | ||
# resp = { | ||
# 'curriculum' : curriculum_serialized, | ||
# } | ||
# return Response(data=resp,status=status.HTTP_200_OK) | ||
|
||
|
||
# @api_view(['GET']) | ||
# @permission_classes([IsAuthenticated]) | ||
# @authentication_classes([TokenAuthentication]) | ||
# def meeting_api(request): | ||
|
||
# if request.method == 'GET': | ||
# meeting = Meeting.objects.all() | ||
# meeting_serialized = serializers.MeetingSerializers(meeting,many=True).data | ||
# resp = { | ||
# 'meeting' : meeting_serialized, | ||
# } | ||
# return Response(data=resp,status=status.HTTP_200_OK) | ||
|
||
|
||
# @api_view(['GET']) | ||
# @permission_classes([IsAuthenticated]) | ||
# @authentication_classes([TokenAuthentication]) | ||
# def calendar_api(request): | ||
|
||
# if request.method == 'GET': | ||
# calendar = Calendar.objects.all() | ||
# calendar_serialized = serializers.CalendarSerializers(calendar,many=True).data | ||
# resp = { | ||
# 'calendar' :calendar_serialized, | ||
# } | ||
# return Response(data=resp,status=status.HTTP_200_OK) | ||
|
||
|
||
# @api_view(['GET']) | ||
# @permission_classes([IsAuthenticated]) | ||
# @authentication_classes([TokenAuthentication]) | ||
# def holiday_api(request): | ||
|
||
# if request.method == 'GET': | ||
# holiday = Holiday.objects.all() | ||
# holiday_serialized = serializers.HolidaySerializers(holiday,many=True).data | ||
# resp = { | ||
# 'holiday' : holiday_serialized, | ||
# } | ||
# return Response(data=resp,status=status.HTTP_200_OK) | ||
|
||
|
||
# @api_view(['GET']) | ||
# @permission_classes([IsAuthenticated]) | ||
# @authentication_classes([TokenAuthentication]) | ||
# def timetable_api(request): | ||
|
||
# if request.method == 'GET': | ||
# timetable = Timetable.objects.all() | ||
# timetable_serialized = serializers.TimetableSerializers(timetable,many=True).data | ||
# resp = { | ||
# 'timetable' : timetable_serialized, | ||
# } | ||
# return Response(data=resp,status=status.HTTP_200_OK) | ||
|
||
|
||
# @api_view(['GET']) | ||
# @permission_classes([IsAuthenticated]) | ||
# @authentication_classes([TokenAuthentication]) | ||
# def exam_timetable_api(request): | ||
|
||
# if request.method == 'GET': | ||
# exam_timetable = Exam_timetable.objects.all() | ||
# exam_timetable_serialized = serializers.Exam_timetableSerializers(exam_timetable,many=True).data | ||
# resp = { | ||
# 'exam_timetable' : exam_timetable_serialized, | ||
# } | ||
# return Response(data=resp,status=status.HTTP_200_OK) | ||
|
||
|
||
# @api_view(['GET']) | ||
# @permission_classes([IsAuthenticated]) | ||
# @authentication_classes([TokenAuthentication]) | ||
# def curriculum_instructor_api(request): | ||
|
||
# if request.method == 'GET': | ||
# curriculum_instructor = Curriculum_Instructor.objects.all() | ||
# curriculum_instructor_serialized = serializers.CurriculumInstructorSerializer(curriculum_instructor,many=True).data | ||
# resp = { | ||
# 'curriculum_instructor' : curriculum_instructor_serialized, | ||
# } | ||
# return Response(data=resp,status=status.HTTP_200_OK) | ||
|
||
|
||
# @api_view(['GET']) | ||
# @permission_classes([IsAuthenticated]) | ||
# @authentication_classes([TokenAuthentication]) | ||
# def student_attendance_api(request): | ||
|
||
# if request.method == 'GET': | ||
# student_attendance = Student_attendance.objects.all() | ||
# student_attendance_serialized = serializers.Student_attendanceSerializers(student_attendance,many=True).data | ||
# resp = { | ||
# 'student_attendance' : student_attendance_serialized, | ||
# } | ||
# return Response(data=resp,status=status.HTTP_200_OK) | ||
|
||
|
||
# @api_view(['GET']) | ||
# @permission_classes([IsAuthenticated]) | ||
# @authentication_classes([TokenAuthentication]) | ||
# def grades_api(request): | ||
|
||
# if request.method == 'GET': | ||
# grades = Grades.objects.all() | ||
# grades_serialized = serializers.GradesSerializers(grades,many=True).data | ||
# resp = { | ||
# 'grades' : grades_serialized, | ||
# } | ||
# return Response(data=resp,status=status.HTTP_200_OK) | ||
|
||
|
||
# @api_view(['GET']) | ||
# @permission_classes([IsAuthenticated]) | ||
# @authentication_classes([TokenAuthentication]) | ||
# def spi_api(request): | ||
|
||
# if request.method == 'GET': | ||
# spi = Spi.objects.all() | ||
# spi_serialized = serializers.SpiSerializers(spi,many=True).data | ||
# resp = { | ||
# 'spi' : spi_serialized, | ||
# } | ||
# return Response(data=resp,status=status.HTTP_200_OK) | ||
def course_api(request): | ||
|
||
if request.method == 'GET': | ||
course = Course.objects.all() | ||
course_serialized = serializers.CourseSerializer(course,many=True).data | ||
resp = { | ||
'courses' : course_serialized, | ||
} | ||
return Response(data=resp,status=status.HTTP_200_OK) | ||
|
||
|
||
|
||
@api_view(['GET']) | ||
@permission_classes([IsAuthenticated]) | ||
@authentication_classes([TokenAuthentication]) | ||
def curriculum_api(request): | ||
|
||
if request.method == 'GET': | ||
curriculum = Curriculum.objects.all() | ||
curriculum_serialized = serializers.CurriculumSerializer(curriculum,many=True).data | ||
resp = { | ||
'curriculum' : curriculum_serialized, | ||
} | ||
return Response(data=resp,status=status.HTTP_200_OK) | ||
|
||
|
||
@api_view(['GET']) | ||
@permission_classes([IsAuthenticated]) | ||
@authentication_classes([TokenAuthentication]) | ||
def meeting_api(request): | ||
|
||
if request.method == 'GET': | ||
meeting = Meeting.objects.all() | ||
meeting_serialized = serializers.MeetingSerializers(meeting,many=True).data | ||
resp = { | ||
'meeting' : meeting_serialized, | ||
} | ||
return Response(data=resp,status=status.HTTP_200_OK) | ||
|
||
|
||
@api_view(['GET']) | ||
@permission_classes([IsAuthenticated]) | ||
@authentication_classes([TokenAuthentication]) | ||
def calendar_api(request): | ||
|
||
if request.method == 'GET': | ||
calendar = Calendar.objects.all() | ||
calendar_serialized = serializers.CalendarSerializers(calendar,many=True).data | ||
resp = { | ||
'calendar' :calendar_serialized, | ||
} | ||
return Response(data=resp,status=status.HTTP_200_OK) | ||
|
||
|
||
@api_view(['GET']) | ||
@permission_classes([IsAuthenticated]) | ||
@authentication_classes([TokenAuthentication]) | ||
def holiday_api(request): | ||
|
||
if request.method == 'GET': | ||
holiday = Holiday.objects.all() | ||
holiday_serialized = serializers.HolidaySerializers(holiday,many=True).data | ||
resp = { | ||
'holiday' : holiday_serialized, | ||
} | ||
return Response(data=resp,status=status.HTTP_200_OK) | ||
|
||
|
||
@api_view(['GET']) | ||
@permission_classes([IsAuthenticated]) | ||
@authentication_classes([TokenAuthentication]) | ||
def timetable_api(request): | ||
|
||
if request.method == 'GET': | ||
timetable = Timetable.objects.all() | ||
timetable_serialized = serializers.TimetableSerializers(timetable,many=True).data | ||
resp = { | ||
'timetable' : timetable_serialized, | ||
} | ||
return Response(data=resp,status=status.HTTP_200_OK) | ||
|
||
|
||
@api_view(['GET']) | ||
@permission_classes([IsAuthenticated]) | ||
@authentication_classes([TokenAuthentication]) | ||
def exam_timetable_api(request): | ||
|
||
if request.method == 'GET': | ||
exam_timetable = Exam_timetable.objects.all() | ||
exam_timetable_serialized = serializers.Exam_timetableSerializers(exam_timetable,many=True).data | ||
resp = { | ||
'exam_timetable' : exam_timetable_serialized, | ||
} | ||
return Response(data=resp,status=status.HTTP_200_OK) | ||
|
||
|
||
@api_view(['GET']) | ||
@permission_classes([IsAuthenticated]) | ||
@authentication_classes([TokenAuthentication]) | ||
def curriculum_instructor_api(request): | ||
|
||
if request.method == 'GET': | ||
curriculum_instructor = Curriculum_Instructor.objects.all() | ||
curriculum_instructor_serialized = serializers.CurriculumInstructorSerializer(curriculum_instructor,many=True).data | ||
resp = { | ||
'curriculum_instructor' : curriculum_instructor_serialized, | ||
} | ||
return Response(data=resp,status=status.HTTP_200_OK) | ||
|
||
|
||
@api_view(['GET']) | ||
@permission_classes([IsAuthenticated]) | ||
@authentication_classes([TokenAuthentication]) | ||
def student_attendance_api(request): | ||
|
||
if request.method == 'GET': | ||
student_attendance = Student_attendance.objects.all() | ||
student_attendance_serialized = serializers.Student_attendanceSerializers(student_attendance,many=True).data | ||
resp = { | ||
'student_attendance' : student_attendance_serialized, | ||
} | ||
return Response(data=resp,status=status.HTTP_200_OK) | ||
|
||
|
||
@api_view(['GET']) | ||
@permission_classes([IsAuthenticated]) | ||
@authentication_classes([TokenAuthentication]) | ||
def grades_api(request): | ||
|
||
if request.method == 'GET': | ||
grades = Grades.objects.all() | ||
grades_serialized = serializers.GradesSerializers(grades,many=True).data | ||
resp = { | ||
'grades' : grades_serialized, | ||
} | ||
return Response(data=resp,status=status.HTTP_200_OK) | ||
|
||
|
||
@api_view(['GET']) | ||
@permission_classes([IsAuthenticated]) | ||
@authentication_classes([TokenAuthentication]) | ||
def spi_api(request): | ||
|
||
if request.method == 'GET': | ||
spi = Spi.objects.all() | ||
spi_serialized = serializers.SpiSerializers(spi,many=True).data | ||
resp = { | ||
'spi' : spi_serialized, | ||
} | ||
return Response(data=resp,status=status.HTTP_200_OK) |
Oops, something went wrong.