Skip to content

Commit dcdc36c

Browse files
dcoder13Lawful2002akshatnemaxenounoSharanKumar06
authored
Gad 2 update (request based system) (#1724)
* (ac-4): week 4: fixed HOD leave module and some bugs in the student leave module. (#1100) * I added my module otheracademic from scratch all functionality is implemented just need to set designation * I added my module otheracademic from scratch all functionality is implemented just need to set designation * I added my module otheracademic from scratch all functionality is implemented just need to set designation * added new usecases * removed migrations files * Otheracademic 2024 (#1316) * I added my module otheracademic from scratch all functionality is implemented just need to set designation * I added my module otheracademic from scratch all functionality is implemented just need to set designation * I added my module otheracademic from scratch all functionality is implemented just need to set designation * Added pylint (#1302) * Create bandit_security_test.yml Added Bandit security test for python * Update bandit_security_test.yml * Update bandit_security_test.yml * Create pylint.yml * Update pylint.yml * Update pylint.yml * Revert "Added pylint (#1302)" (#1324) This reverts commit c1359b7. * removed migrations files --------- Co-authored-by: Hardik Sharma <104981324+hardiksharma11@users.noreply.github.com> Co-authored-by: Raman Chaudhary <97114586+ChaudharyRaman@users.noreply.github.com> * bug fixes * otheracademic update * I added my module otheracademic from scratch all functionality is implemented just need to set designation * I added my module otheracademic from scratch all functionality is implemented just need to set designation * I added my module otheracademic from scratch all functionality is implemented just need to set designation * Added pylint (#1302) * Create bandit_security_test.yml Added Bandit security test for python * Update bandit_security_test.yml * Update bandit_security_test.yml * Create pylint.yml * Update pylint.yml * Update pylint.yml * Revert "Added pylint (#1302)" (#1324) This reverts commit c1359b7. * removed migrations files * changes in programme_cuuriculam,adding version to models (#1330) * bug fixes --------- Co-authored-by: Hardik Sharma <104981324+hardiksharma11@users.noreply.github.com> Co-authored-by: Raman Chaudhary <97114586+ChaudharyRaman@users.noreply.github.com> Co-authored-by: Anudeep Sanapala <71971574+anudeeps0306@users.noreply.github.com> * Updated Dashboard * implemented leave,assistantship,nodues * bug fixes * bug fixes assistantship * bug fixes no dues * I add description to all functions,also removed unnecessary comment,also used better naming,removed hardcoded part of graduateseminar,add description of hod charfield,also described no_dues_not function and working * modifications in notifications * small error fixed * various bug fixes * fix formatting and remove debugging statements for existing views * fix formatting and remove some unnecessary functions * update: all fts specific views require the user to not be student and have valid designation * remove unused urls * add notifications on forward * fix: send notifications from drafts as well * fix: redirect on sending draft * fix remarks to show blank in drafts * fix and cleanup templates * save attachments to drafts and allow .zip attachments * fix formatting and UI changes in compose file template * Delete FusionIIIT/applications/otheracademic/migrations/0002_auto_20240416_2046.py * Delete FusionIIIT/applications/otheracademic/migrations/0003_auto_20240416_2047.py * updated apis for ac-2 module * removed migration files * feat: confirm before unloading page and make the fields not required * app changes * add active tab highlight to sidebar * fix extra html * add File download as zip feature * authorization * fix: small formatting errors * added migration files * fix: inbox, drafts and archives are now ordered by time of creating and reception * fix: forward file to error correctly and improve template * fix: on draft saving without destination redirect is correctly placed * fix: attachments added on sending from drafts * changed files permissions * Changed file persmissions * another file changed * FTS mig change restored * Introduces Subtype option and implemented generate report * Revert "Merging AC-4 to Latest-Staging" * corrected acadadmin login issues * added verify course api endpoint * chore: added updated files for gymkhana in applications and templates * fts user validation fixed and side panel notifications * Delete FusionIIIT/applications/globals/migrations/0015_auto_20240425_0421.py * Delete FusionIIIT/applications/research_procedures/migrations/0004_auto_20240425_0417.py * Delete FusionIIIT/applications/globals/migrations/0014_auto_20240425_0417.py * corrected ac-4 module * refactor: api * Delete FusionIIIT/applications/central_mess/migrations/0010_auto_20240425_0417.py * Introduces Subtype option and implemented generate report * corrected PHC notifications * multi copis * fix acadadmin error * refactor: urls and views * fixed issues of testing * Resolve minor issues * notification error in gad-2 resolved * updated migrations for all modules * add_projects updated * dropdown added * added ps-1 * bug fix in ac-7 * Enable,checks on module and navigate in navbar * Swayam, course code and minor fixes * changes done final * dep final push * delete migrations * Update requirements.txt * Update requirements.txt * Modify viewHIstory API * Update 0001_initial.py * apis added * revert to db sync * added ac-6, rspc * added apis for app * fixed bugs api chages * rebate fix * Update filetracking.html * minor issues in the Dashboard * this commit, adds a new search functionality, a new pagination feature, fixes sorting through dates and fixes archive option enable conditions * updated mig * corrected globals mig * changed allot courses function to update pre registration data using excel sheet * updated user card to show roll no * increase options for less fee payment * Update admin.py * new feat. marks submission, improved attendance and grading scheme * Health Center Contribution - PR201 (#1625) * All changes of health center module * Redundancy bug fixes * Minor bug fix Patie0tn log form undefined behavior when changing radio field * Guideline Configs * Removed print statements according to guidelines --------- Co-authored-by: ChallaBharadwajReddy <challabharadwajreddy@gmail.com> * Configurations for Fusion-client (#1628) * Made updated views for authentication, toggling notifications and removed dashboard view * Made a view for updating a role * migration files for changes made in extra_info model --------- Co-authored-by: Pratik <pratiksolanki2026@gmail.com> * fix: Resolved System Check errors (#1630) - fix: Changed one line bugs * Resolved system check errors * Changed some fields in IWD Module * Fixes creation of unwanted migration files - chore: migration files for the previous commit changes * Added API folder in iwdModuleV2 * Added endpoints in API folder in iwdModuleV2 * Added additional endpoints in API folder in iwdModuleV2 * fix[api] : fetchdesignation, requestview * fix : view file endpoint * Resolved Major bug and also added username field in auth data (#1635) * Made updated views for authentication, toggling notifications and removed dashboard view * Made a view for updating a role * migration files for changes made in extra_info model * Health Center Contribution - PR201 (#1625) * All changes of health center module * Redundancy bug fixes * Minor bug fix Patie0tn log form undefined behavior when changing radio field * Guideline Configs * Removed print statements according to guidelines --------- Co-authored-by: ChallaBharadwajReddy <challabharadwajreddy@gmail.com> * fix: Resolved System Check errors (#1630) - fix: Changed one line bugs * Resolved system check errors * Changed some fields in IWD Module * Fixes creation of unwanted migration files - chore: migration files for the previous commit changes * fix: Resolved major bug and also added username field in auth data. --------- Co-authored-by: ramGopal <129493911+ramG-reddy@users.noreply.github.com> Co-authored-by: ChallaBharadwajReddy <challabharadwajreddy@gmail.com> * minor updates while updating the issue-work-order table (#4) * minor changes (#5) * minor changes * minor changes * approve/reject and view file * fix: work order * Minor changes in addBudget and editBudget endpoints (#6) * fix : serializer * modified views related to audit document view (#7) * Added API folder in iwdModuleV2 * modified views related to audit document view * Minor changes for integration with frontend * fixed apis * fix: serializer overriding requestCreatedBdBy value * fix: serializer overriding requestCreatedBdBy value * fix api * chore: made handlers consistent * fix: some minor fixes * major fixes * minor fixes * add: updated urls.py and file upload * fix: handle dean process request file attachment upload * fix : forward file * Test os 3 (#1700) * Setup Email Notifications and architected new announcement system * Added module to announcement schema and lazy loading to specific_users * Added create announcement and get announcement apis and added redis as dependency * Sorted GET Announcement result order * department info api (#1) Co-authored-by: aarav0012 <aaravjainjn@email.com> * rspc notification api added --------- Co-authored-by: Akash Kumar Sah <akashsah2003@gmail.com> Co-authored-by: aarav0012 <aaravjainjn@email.com> * Dashboard client (#1697) * Get Booking data api added (#1) * bug: fix conditional rendering of booking req * Dashboard client (#3) * Get Booking data api added * active booking api * add: forwardBooking confirmBooking * Dashboard client (#4) * Get Booking data api added * active booking api * Added cancelled, active, completed booking view functionality * cancellation_request done * reject option works * Add items backend functionality (#5) * add: rooms availibility * fix: urls * add: Account statement backend (#6) * "add: account statements" * resolved MC * Updated visitor_hostel URLs and views:added partial booking API (#7) Co-authored-by: Arun7113 <arunhyd2003@gmail.com> * fix: partial booking feature * fix: completed bookings * fix: account statement * fix: correct income display on account statement --------- Co-authored-by: Hardik Vardaan <37293677+AtOM18@users.noreply.github.com> Co-authored-by: ompandey0703 <142932201+ompandey0703@users.noreply.github.com> Co-authored-by: Vishal-Github-21 <116187488+Vishal-Github-21@users.noreply.github.com> Co-authored-by: JATOTHU ARUN <167317035+Pheonix7113@users.noreply.github.com> Co-authored-by: Arun7113 <arunhyd2003@gmail.com> * All changes of Complaint Management (#1704) * eis module version 1 (#1706) * fix: multiple file uploads, and ajax dropdown cbv * add: added multiple drafts upload * fix: uncommented mess migrations * Department module Version 1 (#1709) * [Dashboard] Modified Profile views to fetch relevant data only (#1711) * SA-2 [New-UI] - updated APIs for use with fusion-client (#1717) * chore: added linting * changes in feedbackAPI * feat: added update bill excel (#4) * fix: migrations * Fix: Fixed an api endpoint allowed method (#5) * Added New API for Student Records, Implement Checks in RebateAPI. (#6) * Change in feedbackAPI * New API and filter in RebateApi * Fix merge * fix: api cleanup --------- Co-authored-by: S-tej <132924903+S-tej@users.noreply.github.com> Co-authored-by: Padarthi Karthik <133255355+karthikpadarthi@users.noreply.github.com> Co-authored-by: Green Mansion <90859709+PrinceBujethia@users.noreply.github.com> * SA-2 new UI updates (#1718) * chore: added linting * changes in feedbackAPI * feat: added update bill excel (#4) * fix: migrations * Fix: Fixed an api endpoint allowed method (#5) * Added New API for Student Records, Implement Checks in RebateAPI. (#6) * Change in feedbackAPI * New API and filter in RebateApi * Fix merge * fix: api cleanup * deployment fixes --------- Co-authored-by: S-tej <132924903+S-tej@users.noreply.github.com> Co-authored-by: Padarthi Karthik <133255355+karthikpadarthi@users.noreply.github.com> Co-authored-by: Green Mansion <90859709+PrinceBujethia@users.noreply.github.com> * Old version(gad 2) (#1721) * Added API folder in iwdModuleV2 * Added endpoints in API folder in iwdModuleV2 * Added additional endpoints in API folder in iwdModuleV2 * fix[api] : fetchdesignation, requestview * fix : view file endpoint * minor updates while updating the issue-work-order table (#4) * minor changes (#5) * minor changes * minor changes * approve/reject and view file * fix: work order * Minor changes in addBudget and editBudget endpoints (#6) * fix : serializer * modified views related to audit document view (#7) * Added API folder in iwdModuleV2 * modified views related to audit document view * fixed apis * fix: serializer overriding requestCreatedBdBy value * fix: serializer overriding requestCreatedBdBy value * fix api * chore: made handlers consistent * major fixes * fix: handle dean process request file attachment upload * fix : forward file --------- Co-authored-by: Bhargavzz <vishnubhargavsitra@gmail.com> Co-authored-by: Abhijeet <pabhijeet349@gmail.com> Co-authored-by: dotniiko <115548274+dotniiko@users.noreply.github.com> Co-authored-by: Dhruv Ratmele <129955117+Somgester@users.noreply.github.com> Co-authored-by: Abhijeet Patil <133658873+abhiJeetP10@users.noreply.github.com> Co-authored-by: Bhargavzz <133690080+Bhargavzz@users.noreply.github.com> * Revert "Old version(gad 2) (#1721)" (#1723) This reverts commit e528b98. * fix:migrations --------- Co-authored-by: Harshvardhan Singh <73544247+Lawful2002@users.noreply.github.com> Co-authored-by: akshatnema <20bcs022@iiitdmj.ac.in> Co-authored-by: Jack <jatindagar101@gmail.com> Co-authored-by: SharanKumar06 <sharan123852@gmail.com> Co-authored-by: xenouno <112983459+xenouno@users.noreply.github.com> Co-authored-by: Hardik Sharma <104981324+hardiksharma11@users.noreply.github.com> Co-authored-by: Raman Chaudhary <97114586+ChaudharyRaman@users.noreply.github.com> Co-authored-by: Anudeep Sanapala <71971574+anudeeps0306@users.noreply.github.com> Co-authored-by: Priyansh Mehta <96513964+Priyansh61@users.noreply.github.com> Co-authored-by: Divyansh Tripathi <55395696+theoden42@users.noreply.github.com> Co-authored-by: Aragorn-64 <advaysagarkar@gmail.com> Co-authored-by: Prabhat Suman <32027224+prabhatsuman@users.noreply.github.com> Co-authored-by: Bhavik Agarwal <bhavikiitian@gmail.com> Co-authored-by: 21bcs035 <ar5136874yadav@gmail.com> Co-authored-by: Mohit Saini <mailtomohit2002@gmail.com> Co-authored-by: prabhatsuman <mr.prabhatsuman@gmail.com> Co-authored-by: Prajjwal kapoor <68912239+prajjwalkapoor@users.noreply.github.com> Co-authored-by: Varun Singh <73738410+varun7singh@users.noreply.github.com> Co-authored-by: Divyanshu Sharma <21bcs079@iiitdmj.ac.in> Co-authored-by: Anurag Goswami <maskeddeep@gmail.com> Co-authored-by: Ravichendraa <ravichendraa@gmail.com> Co-authored-by: itsspriyansh <priyanshkp01@gmail.com> Co-authored-by: Daksh Bajaj <97049092+Daksh119@users.noreply.github.com> Co-authored-by: Priyansh <88396544+itsspriyansh@users.noreply.github.com> Co-authored-by: TusharGupta03 <tushargupta0312@gmail.com> Co-authored-by: Prajjwal Kapoor <prajjwal.kapoor.mail@gmail.com> Co-authored-by: aish0749 <aishwaryasaxena57@gmail.com> Co-authored-by: Harshul-25 <charshul25@gmail.com> Co-authored-by: hrithik09 <ranjan.hrithik09@gmail.com> Co-authored-by: SukulSarve <143542658+SukulSarve@users.noreply.github.com> Co-authored-by: ramGopal <129493911+ramG-reddy@users.noreply.github.com> Co-authored-by: ChallaBharadwajReddy <challabharadwajreddy@gmail.com> Co-authored-by: Pratik <pratiksolanki2026@gmail.com> Co-authored-by: Bhargavzz <vishnubhargavsitra@gmail.com> Co-authored-by: Abhijeet <pabhijeet349@gmail.com> Co-authored-by: Pratik Solanki <128511266+Pratik2026@users.noreply.github.com> Co-authored-by: dotniiko <115548274+dotniiko@users.noreply.github.com> Co-authored-by: Dhruv Ratmele <129955117+Somgester@users.noreply.github.com> Co-authored-by: Abhijeet Patil <133658873+abhiJeetP10@users.noreply.github.com> Co-authored-by: Bhargavzz <133690080+Bhargavzz@users.noreply.github.com> Co-authored-by: Zaid Alam <predcodes695@gmail.com> Co-authored-by: Aarav Jain <128894052+aarav0012@users.noreply.github.com> Co-authored-by: Akash Kumar Sah <akashsah2003@gmail.com> Co-authored-by: aarav0012 <aaravjainjn@email.com> Co-authored-by: SHRAMAN PAUL <pkpaulpostdn@gmail.com> Co-authored-by: Hardik Vardaan <37293677+AtOM18@users.noreply.github.com> Co-authored-by: ompandey0703 <142932201+ompandey0703@users.noreply.github.com> Co-authored-by: Vishal-Github-21 <116187488+Vishal-Github-21@users.noreply.github.com> Co-authored-by: JATOTHU ARUN <167317035+Pheonix7113@users.noreply.github.com> Co-authored-by: Arun7113 <arunhyd2003@gmail.com> Co-authored-by: K.Charan Teja Reddy <129493881+Charan2437@users.noreply.github.com> Co-authored-by: Ramesh Babu <srameshbabu2004@gmail.com> Co-authored-by: Vithesh Krishna <133671028+Vithesh2215@users.noreply.github.com> Co-authored-by: Aditya Kumar Gupta <116958420+Adi8712@users.noreply.github.com> Co-authored-by: S-tej <132924903+S-tej@users.noreply.github.com> Co-authored-by: Padarthi Karthik <133255355+karthikpadarthi@users.noreply.github.com> Co-authored-by: Green Mansion <90859709+PrinceBujethia@users.noreply.github.com>
1 parent 40dd12e commit dcdc36c

File tree

443 files changed

+39110
-14203
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

443 files changed

+39110
-14203
lines changed

.gitignore

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -75,4 +75,6 @@ package-lock.json
7575

7676

7777
.DS_Store
78+
**/generated.pdf
7879

80+
.ruff_cache/

.pre-commit-config.yaml

Lines changed: 14 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,14 @@
1+
repos:
2+
- repo: https://github.com/pre-commit/pre-commit-hooks
3+
rev: v3.2.0
4+
hooks:
5+
- id: trailing-whitespace
6+
- id: end-of-file-fixer
7+
- id: check-yaml
8+
- id: check-added-large-files
9+
- repo: https://github.com/astral-sh/ruff-pre-commit
10+
rev: v0.6.9
11+
hooks:
12+
- id: ruff
13+
args: [ --fix ]
14+
- id: ruff-format

FusionIIIT/Fusion/middleware/custom_middleware.py

Lines changed: 15 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@
22
from django.contrib.auth.signals import user_logged_in
33
from django.dispatch import receiver
44
from applications.globals.models import (ExtraInfo, Feedback, HoldsDesignation,
5-
Issue, IssueImage, DepartmentInfo)
5+
Issue, IssueImage, DepartmentInfo,ModuleAccess)
66
from django.shortcuts import get_object_or_404, redirect, render
77

88
def user_logged_in_middleware(get_response):
@@ -35,7 +35,19 @@ def user_logged_in_handler(sender, user, request, **kwargs):
3535
print(i)
3636

3737
request.session['currentDesignationSelected'] = designation[0]
38-
request.session['allDesignations'] = designation
38+
request.session['allDesignations'] = designation
39+
first_designation = designation[0]
40+
module_access = ModuleAccess.objects.filter(designation=first_designation).first()
41+
42+
if module_access:
43+
access_rights = {}
44+
45+
field_names = [field.name for field in ModuleAccess._meta.get_fields() if field.name not in ['id', 'designation']]
46+
47+
for field_name in field_names:
48+
access_rights[field_name] = getattr(module_access, field_name)
49+
50+
request.session['moduleAccessRights'] = access_rights
3951
print("logged iN")
4052

4153
# Set the flag in the session to indicate that the function has bee+n executed
@@ -47,4 +59,4 @@ def middleware(request):
4759
response = get_response(request)
4860
return response
4961

50-
return middleware
62+
return middleware

FusionIIIT/Fusion/settings/common.py

Lines changed: 8 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -51,6 +51,7 @@
5151
# email of sender
5252

5353
EMAIL_HOST_USER = 'fusionmailservice@iiitdmj.ac.in'
54+
# EMAIL_HOST_PASSWORD = 'password'
5455

5556
EMAIL_PORT = 587
5657
ACCOUNT_EMAIL_REQUIRED = True
@@ -79,8 +80,8 @@
7980

8081

8182
# CELERY STUFF
82-
# CELERY_BROKER_URL = 'redis://localhost:6379'
83-
# CELERY_RESULT_BACKEND = 'redis://localhost:6379'
83+
CELERY_BROKER_URL = 'redis://localhost:6379'
84+
CELERY_RESULT_BACKEND = 'redis://localhost:6379'
8485
CELERY_ACCEPT_CONTENT = ['application/json']
8586
CELERY_TASK_SERIALIZER = 'json'
8687
CELERY_RESULT_SERIALIZER = 'json'
@@ -128,6 +129,7 @@
128129
'applications.ps1',
129130
'applications.programme_curriculum',
130131
'applications.placement_cell',
132+
'applications.otheracademic',
131133
'applications.recruitment',
132134
'applications.scholarships',
133135
'applications.visitor_hostel',
@@ -279,7 +281,10 @@
279281
DATA_UPLOAD_MAX_NUMBER_FIELDS = 10240
280282
YOUTUBE_DATA_API_KEY = 'api_key'
281283

284+
CORS_ALLOWED_ORIGINS = [
285+
"http://localhost:5173", # Add your frontend origin here
286+
]
282287

288+
CORS_ALLOW_CREDENTIALS = True
283289

284-
CORS_ORIGIN_ALLOW_ALL = True
285290
ALLOW_PASS_RESET = True

FusionIIIT/Fusion/urls.py

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -22,6 +22,8 @@
2222
from django.contrib import admin
2323
from django.contrib.auth import views as auth_views
2424

25+
from django.views.static import serve
26+
2527

2628
urlpatterns = [
2729
url(r'^', include('applications.globals.urls')),
@@ -37,6 +39,8 @@
3739
url(r'^__debug__/', include(debug_toolbar.urls)),
3840
url(r'^research_procedures/', include('applications.research_procedures.urls')),
3941
url(r'^accounts/', include('allauth.urls')),
42+
43+
# url(r'^api/iwdModuleV2/', include('applications.iwdModuleV2.api.urls')),
4044

4145

4246
url(r'^eis/', include('applications.eis.urls')),
@@ -61,4 +65,6 @@
6165
url(r'^hr2/', include('applications.hr2.urls')),
6266
url(r'^recruitment/', include('applications.recruitment.urls')),
6367
url(r'^examination/', include('applications.examination.urls')),
68+
url(r'^otheracademic/', include('applications.otheracademic.urls')),
69+
url(r'^media/(?P<path>.*)$', serve, {"document_root": settings.MEDIA_ROOT},),
6470
] + static(settings.MEDIA_URL, document_root=settings.MEDIA_ROOT)

FusionIIIT/applications/academic_information/api/urls.py

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -14,7 +14,8 @@
1414

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

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

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

FusionIIIT/applications/academic_information/api/views.py

Lines changed: 21 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -12,6 +12,7 @@
1212
from applications.globals.models import User,ExtraInfo
1313
from applications.academic_information.models import Student, Course, Curriculum, Curriculum_Instructor, Student_attendance, Meeting, Calendar, Holiday, Grades, Spi, Timetable, Exam_timetable
1414
from . import serializers
15+
from rest_framework.generics import ListCreateAPIView
1516

1617
@api_view(['GET'])
1718
@permission_classes([IsAuthenticated])
@@ -82,7 +83,26 @@ def calendar_api(request):
8283
'calendar' :calendar_serialized,
8384
}
8485
return Response(data=resp,status=status.HTTP_200_OK)
85-
86+
87+
class ListCalendarView(ListCreateAPIView):
88+
permission_classes = [IsAuthenticated]
89+
authentication_classes=[TokenAuthentication]
90+
serializer_class = serializers.CalendarSerializers
91+
queryset = Calendar.objects.all()
92+
93+
@api_view(['PUT'])
94+
@permission_classes([IsAuthenticated])
95+
@authentication_classes([TokenAuthentication])
96+
def update_calendar(request):
97+
if request.method == "PUT":
98+
id = request.data.get("id")
99+
instance = Calendar.objects.get(pk = id)
100+
instance.from_date = request.data.get("from_date")
101+
instance.to_date = request.data.get("to_date")
102+
instance.description = request.data.get("description")
103+
instance.save()
104+
105+
return Response({"message": "Updated successfully!"})
86106

87107
@api_view(['GET'])
88108
@permission_classes([IsAuthenticated])

FusionIIIT/applications/academic_information/migrations/0001_initial.py

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
# Generated by Django 3.1.5 on 2024-04-15 23:58
1+
# Generated by Django 3.1.5 on 2024-07-16 15:44
22

33
from django.db import migrations, models
44
import django.db.models.deletion
@@ -9,8 +9,8 @@ class Migration(migrations.Migration):
99
initial = True
1010

1111
dependencies = [
12-
('globals', '0001_initial'),
1312
('programme_curriculum', '0001_initial'),
13+
('globals', '0001_initial'),
1414
]
1515

1616
operations = [

FusionIIIT/applications/academic_information/views.py

Lines changed: 21 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -30,7 +30,7 @@
3030

3131
from applications.academic_procedures.views import acad_proced_global_context , get_sem_courses
3232
from applications.programme_curriculum.models import Batch
33-
33+
from django.db.models import Q
3434

3535

3636
@login_required
@@ -845,6 +845,8 @@ def generatexlsheet(request):
845845
# print(request.POST)
846846
try:
847847
batch = request.POST['batch']#batch hai year wala (2020 , 21)
848+
if batch == "":
849+
batch = datetime.datetime.now().year
848850
course_id = int(request.POST['course']) # id of course in integer
849851
course = course = Courses.objects.get(id=course_id)
850852

@@ -858,17 +860,26 @@ def generatexlsheet(request):
858860
obj=""
859861

860862
registered_courses = []
861-
for i in obj:
862-
if i.student_id.batch_id.year == int(batch):
863-
registered_courses.append(i)
863+
registered_courses = course_registration.objects.filter(
864+
Q(working_year=int(batch)) &
865+
Q(course_id=course) &
866+
Q(student_id__finalregistration__verified=True)
867+
)
868+
869+
# for i in obj:
870+
# if i.student_id.batch_id.year == int(batch):
871+
# registered_courses.append(i)
864872
ans = []
873+
student_ids = set()
865874
for i in registered_courses:
866-
k = []
867-
k.append(i.student_id.id.id)
868-
k.append(i.student_id.id.user.first_name)
869-
k.append(i.student_id.id.user.last_name)
870-
k.append(i.student_id.id.department)
871-
ans.append(k)
875+
if i.student_id.id.id not in student_ids:
876+
student_ids.add(i.student_id.id.id )
877+
k = []
878+
k.append(i.student_id.id.id)
879+
k.append(i.student_id.id.user.first_name)
880+
k.append(i.student_id.id.user.last_name)
881+
k.append(i.student_id.id.department)
882+
ans.append(k)
872883
ans.sort()
873884
output = BytesIO()
874885

FusionIIIT/applications/academic_procedures/api/serializers.py

Lines changed: 7 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,9 @@
33

44
from applications.academic_procedures.models import (ThesisTopicProcess, InitialRegistrations,InitialRegistration,
55
FinalRegistration, FinalRegistrations, SemesterMarks,
6-
BranchChange , StudentRegistrationChecks, Semester, backlog_course , CourseSlot , FeePayments , Course, course_registration)
6+
BranchChange , StudentRegistrationChecks, Semester, backlog_course , CourseSlot , FeePayments , course_registration)
7+
8+
from applications.programme_curriculum.models import Course
79

810
from applications.academic_information.api.serializers import (CurriculumInstructorSerializer,
911
CurriculumSerializer , CourseSerializer , StudentSerializers )
@@ -73,7 +75,10 @@ class Meta:
7375
model = CourseSlot
7476
fields = ('__all__')
7577

78+
7679
class CourseSerializer(serializers.ModelSerializer):
80+
7781
class Meta:
7882
model = Course
79-
fields = ('__all__')
83+
fields = ['id','code','name','credit']
84+

0 commit comments

Comments
 (0)