Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Updated APIs for AC-2 module #1520

Merged
merged 2 commits into from
Apr 25, 2024
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
3 changes: 2 additions & 1 deletion FusionIIIT/applications/academic_information/api/urls.py
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,8 @@

# url(r'^meeting',views.meeting_api,name='meeting-get-api'),

# url(r'^calendar',views.calendar_api,name='calendar-get-api'),
url(r'^calendar',views.ListCalendarView.as_view(),name='calendar-get-api'),
url(r'^update-calendar',views.update_calendar,name='calendar-update-api'),

# url(r'^holiday',views.holiday_api,name='holiday-get-api'),

Expand Down
22 changes: 21 additions & 1 deletion FusionIIIT/applications/academic_information/api/views.py
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,7 @@
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
from rest_framework.generics import ListCreateAPIView

@api_view(['GET'])
@permission_classes([IsAuthenticated])
Expand Down Expand Up @@ -82,7 +83,26 @@ def calendar_api(request):
'calendar' :calendar_serialized,
}
return Response(data=resp,status=status.HTTP_200_OK)


class ListCalendarView(ListCreateAPIView):
permission_classes = [IsAuthenticated]
authentication_classes=[TokenAuthentication]
serializer_class = serializers.CalendarSerializers
queryset = Calendar.objects.all()

@api_view(['PUT'])
@permission_classes([IsAuthenticated])
@authentication_classes([TokenAuthentication])
def update_calendar(request):
if request.method == "PUT":
id = request.data.get("id")
instance = Calendar.objects.get(pk = id)
instance.from_date = request.data.get("from_date")
instance.to_date = request.data.get("to_date")
instance.description = request.data.get("description")
instance.save()

return Response({"message": "Updated successfully!"})

@api_view(['GET'])
@permission_classes([IsAuthenticated])
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,9 @@

from applications.academic_procedures.models import (ThesisTopicProcess, InitialRegistrations,InitialRegistration,
FinalRegistration, FinalRegistrations, SemesterMarks,
BranchChange , StudentRegistrationChecks, Semester, backlog_course , CourseSlot , FeePayments , Course, course_registration)
BranchChange , StudentRegistrationChecks, Semester, backlog_course , CourseSlot , FeePayments , course_registration)

from applications.programme_curriculum.models import Course

from applications.academic_information.api.serializers import (CurriculumInstructorSerializer,
CurriculumSerializer , CourseSerializer , StudentSerializers )
Expand Down Expand Up @@ -73,7 +75,10 @@ class Meta:
model = CourseSlot
fields = ('__all__')


class CourseSerializer(serializers.ModelSerializer):

class Meta:
model = Course
fields = ('__all__')
fields = ['id','code','name','credit']

1 change: 1 addition & 0 deletions FusionIIIT/applications/academic_procedures/api/urls.py
Original file line number Diff line number Diff line change
Expand Up @@ -18,6 +18,7 @@

url(r'^acad/view_registrations' , views.acad_view_reigstrations , name='acad_view_registrations'),
url(r'^acad/verify_registration' , views.verify_registration , name='verify_registration'),
url(r'^acad/verify_course' , views.verify_course , name='verify_course'),
url(r'^acad/get_course_list' , views.get_course_list , name = 'get_course_list' ),
url(r'^acad/get_all_courses' , views.get_all_courses , name = 'get_all_courses' ),
url(r'^acad/gen_roll_list' , views.gen_roll_list , name = 'gen_roll_list' ),
Expand Down
Loading